Subversion Repositories SmartDukaan

Rev

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

Rev 477 Rev 483
Line 14... Line 14...
14
except:
14
except:
15
  fastbinary = None
15
  fastbinary = None
16
 
16
 
17
 
17
 
18
class Iface:
18
class Iface:
-
 
19
  def getLogisticsInfo(self, destination_pincode, sku_id):
-
 
20
    """
-
 
21
    Parameters:
-
 
22
     - destination_pincode
-
 
23
     - sku_id
-
 
24
    """
-
 
25
    pass
-
 
26
 
19
  def getLogisticsEstimation(self, itemId, destination_pin, provider_id):
27
  def getLogisticsEstimation(self, itemId, destination_pin, provider_id):
20
    """
28
    """
21
    Parameters:
29
    Parameters:
22
     - itemId
30
     - itemId
23
     - destination_pin
31
     - destination_pin
Line 116... Line 124...
116
    self._iprot = self._oprot = iprot
124
    self._iprot = self._oprot = iprot
117
    if oprot != None:
125
    if oprot != None:
118
      self._oprot = oprot
126
      self._oprot = oprot
119
    self._seqid = 0
127
    self._seqid = 0
120
 
128
 
-
 
129
  def getLogisticsInfo(self, destination_pincode, sku_id):
-
 
130
    """
-
 
131
    Parameters:
-
 
132
     - destination_pincode
-
 
133
     - sku_id
-
 
134
    """
-
 
135
    self.send_getLogisticsInfo(destination_pincode, sku_id)
-
 
136
    return self.recv_getLogisticsInfo()
-
 
137
 
-
 
138
  def send_getLogisticsInfo(self, destination_pincode, sku_id):
-
 
139
    self._oprot.writeMessageBegin('getLogisticsInfo', TMessageType.CALL, self._seqid)
-
 
140
    args = getLogisticsInfo_args()
-
 
141
    args.destination_pincode = destination_pincode
-
 
142
    args.sku_id = sku_id
-
 
143
    args.write(self._oprot)
-
 
144
    self._oprot.writeMessageEnd()
-
 
145
    self._oprot.trans.flush()
-
 
146
 
-
 
147
  def recv_getLogisticsInfo(self, ):
-
 
148
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
149
    if mtype == TMessageType.EXCEPTION:
-
 
150
      x = TApplicationException()
-
 
151
      x.read(self._iprot)
-
 
152
      self._iprot.readMessageEnd()
-
 
153
      raise x
-
 
154
    result = getLogisticsInfo_result()
-
 
155
    result.read(self._iprot)
-
 
156
    self._iprot.readMessageEnd()
-
 
157
    if result.success != None:
-
 
158
      return result.success
-
 
159
    if result.se != None:
-
 
160
      raise result.se
-
 
161
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getLogisticsInfo failed: unknown result");
-
 
162
 
121
  def getLogisticsEstimation(self, itemId, destination_pin, provider_id):
163
  def getLogisticsEstimation(self, itemId, destination_pin, provider_id):
122
    """
164
    """
123
    Parameters:
165
    Parameters:
124
     - itemId
166
     - itemId
125
     - destination_pin
167
     - destination_pin
Line 496... Line 538...
496
 
538
 
497
class Processor(Iface, TProcessor):
539
class Processor(Iface, TProcessor):
498
  def __init__(self, handler):
540
  def __init__(self, handler):
499
    self._handler = handler
541
    self._handler = handler
500
    self._processMap = {}
542
    self._processMap = {}
-
 
543
    self._processMap["getLogisticsInfo"] = Processor.process_getLogisticsInfo
501
    self._processMap["getLogisticsEstimation"] = Processor.process_getLogisticsEstimation
544
    self._processMap["getLogisticsEstimation"] = Processor.process_getLogisticsEstimation
502
    self._processMap["addDeliveryEstimate"] = Processor.process_addDeliveryEstimate
545
    self._processMap["addDeliveryEstimate"] = Processor.process_addDeliveryEstimate
503
    self._processMap["addPincodeWarehouseMapping"] = Processor.process_addPincodeWarehouseMapping
546
    self._processMap["addPincodeWarehouseMapping"] = Processor.process_addPincodeWarehouseMapping
504
    self._processMap["addEmptyAWBs"] = Processor.process_addEmptyAWBs
547
    self._processMap["addEmptyAWBs"] = Processor.process_addEmptyAWBs
505
    self._processMap["getEmptyAWB"] = Processor.process_getEmptyAWB
548
    self._processMap["getEmptyAWB"] = Processor.process_getEmptyAWB
Line 524... Line 567...
524
      return
567
      return
525
    else:
568
    else:
526
      self._processMap[name](self, seqid, iprot, oprot)
569
      self._processMap[name](self, seqid, iprot, oprot)
527
    return True
570
    return True
528
 
571
 
-
 
572
  def process_getLogisticsInfo(self, seqid, iprot, oprot):
-
 
573
    args = getLogisticsInfo_args()
-
 
574
    args.read(iprot)
-
 
575
    iprot.readMessageEnd()
-
 
576
    result = getLogisticsInfo_result()
-
 
577
    try:
-
 
578
      result.success = self._handler.getLogisticsInfo(args.destination_pincode, args.sku_id)
-
 
579
    except LogisticsServiceException, se:
-
 
580
      result.se = se
-
 
581
    oprot.writeMessageBegin("getLogisticsInfo", TMessageType.REPLY, seqid)
-
 
582
    result.write(oprot)
-
 
583
    oprot.writeMessageEnd()
-
 
584
    oprot.trans.flush()
-
 
585
 
529
  def process_getLogisticsEstimation(self, seqid, iprot, oprot):
586
  def process_getLogisticsEstimation(self, seqid, iprot, oprot):
530
    args = getLogisticsEstimation_args()
587
    args = getLogisticsEstimation_args()
531
    args.read(iprot)
588
    args.read(iprot)
532
    iprot.readMessageEnd()
589
    iprot.readMessageEnd()
533
    result = getLogisticsEstimation_result()
590
    result = getLogisticsEstimation_result()
Line 662... Line 719...
662
    oprot.trans.flush()
719
    oprot.trans.flush()
663
 
720
 
664
 
721
 
665
# HELPER FUNCTIONS AND STRUCTURES
722
# HELPER FUNCTIONS AND STRUCTURES
666
 
723
 
-
 
724
class getLogisticsInfo_args:
-
 
725
  """
-
 
726
  Attributes:
-
 
727
   - destination_pincode
-
 
728
   - sku_id
-
 
729
  """
-
 
730
 
-
 
731
  thrift_spec = (
-
 
732
    None, # 0
-
 
733
    (1, TType.STRING, 'destination_pincode', None, None, ), # 1
-
 
734
    (2, TType.STRING, 'sku_id', None, None, ), # 2
-
 
735
  )
-
 
736
 
-
 
737
  def __init__(self, destination_pincode=None, sku_id=None,):
-
 
738
    self.destination_pincode = destination_pincode
-
 
739
    self.sku_id = sku_id
-
 
740
 
-
 
741
  def read(self, iprot):
-
 
742
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
743
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
744
      return
-
 
745
    iprot.readStructBegin()
-
 
746
    while True:
-
 
747
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
748
      if ftype == TType.STOP:
-
 
749
        break
-
 
750
      if fid == 1:
-
 
751
        if ftype == TType.STRING:
-
 
752
          self.destination_pincode = iprot.readString();
-
 
753
        else:
-
 
754
          iprot.skip(ftype)
-
 
755
      elif fid == 2:
-
 
756
        if ftype == TType.STRING:
-
 
757
          self.sku_id = iprot.readString();
-
 
758
        else:
-
 
759
          iprot.skip(ftype)
-
 
760
      else:
-
 
761
        iprot.skip(ftype)
-
 
762
      iprot.readFieldEnd()
-
 
763
    iprot.readStructEnd()
-
 
764
 
-
 
765
  def write(self, oprot):
-
 
766
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
767
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
768
      return
-
 
769
    oprot.writeStructBegin('getLogisticsInfo_args')
-
 
770
    if self.destination_pincode != None:
-
 
771
      oprot.writeFieldBegin('destination_pincode', TType.STRING, 1)
-
 
772
      oprot.writeString(self.destination_pincode)
-
 
773
      oprot.writeFieldEnd()
-
 
774
    if self.sku_id != None:
-
 
775
      oprot.writeFieldBegin('sku_id', TType.STRING, 2)
-
 
776
      oprot.writeString(self.sku_id)
-
 
777
      oprot.writeFieldEnd()
-
 
778
    oprot.writeFieldStop()
-
 
779
    oprot.writeStructEnd()
-
 
780
 
-
 
781
  def __repr__(self):
-
 
782
    L = ['%s=%r' % (key, value)
-
 
783
      for key, value in self.__dict__.iteritems()]
-
 
784
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
785
 
-
 
786
  def __eq__(self, other):
-
 
787
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
788
 
-
 
789
  def __ne__(self, other):
-
 
790
    return not (self == other)
-
 
791
 
-
 
792
class getLogisticsInfo_result:
-
 
793
  """
-
 
794
  Attributes:
-
 
795
   - success
-
 
796
   - se
-
 
797
  """
-
 
798
 
-
 
799
  thrift_spec = (
-
 
800
    (0, TType.STRUCT, 'success', (LogisticsInfo, LogisticsInfo.thrift_spec), None, ), # 0
-
 
801
    (1, TType.STRUCT, 'se', (LogisticsServiceException, LogisticsServiceException.thrift_spec), None, ), # 1
-
 
802
  )
-
 
803
 
-
 
804
  def __init__(self, success=None, se=None,):
-
 
805
    self.success = success
-
 
806
    self.se = se
-
 
807
 
-
 
808
  def read(self, iprot):
-
 
809
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
810
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
811
      return
-
 
812
    iprot.readStructBegin()
-
 
813
    while True:
-
 
814
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
815
      if ftype == TType.STOP:
-
 
816
        break
-
 
817
      if fid == 0:
-
 
818
        if ftype == TType.STRUCT:
-
 
819
          self.success = LogisticsInfo()
-
 
820
          self.success.read(iprot)
-
 
821
        else:
-
 
822
          iprot.skip(ftype)
-
 
823
      elif fid == 1:
-
 
824
        if ftype == TType.STRUCT:
-
 
825
          self.se = LogisticsServiceException()
-
 
826
          self.se.read(iprot)
-
 
827
        else:
-
 
828
          iprot.skip(ftype)
-
 
829
      else:
-
 
830
        iprot.skip(ftype)
-
 
831
      iprot.readFieldEnd()
-
 
832
    iprot.readStructEnd()
-
 
833
 
-
 
834
  def write(self, oprot):
-
 
835
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
836
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
837
      return
-
 
838
    oprot.writeStructBegin('getLogisticsInfo_result')
-
 
839
    if self.success != None:
-
 
840
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
-
 
841
      self.success.write(oprot)
-
 
842
      oprot.writeFieldEnd()
-
 
843
    if self.se != None:
-
 
844
      oprot.writeFieldBegin('se', TType.STRUCT, 1)
-
 
845
      self.se.write(oprot)
-
 
846
      oprot.writeFieldEnd()
-
 
847
    oprot.writeFieldStop()
-
 
848
    oprot.writeStructEnd()
-
 
849
 
-
 
850
  def __repr__(self):
-
 
851
    L = ['%s=%r' % (key, value)
-
 
852
      for key, value in self.__dict__.iteritems()]
-
 
853
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
854
 
-
 
855
  def __eq__(self, other):
-
 
856
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
857
 
-
 
858
  def __ne__(self, other):
-
 
859
    return not (self == other)
-
 
860
 
667
class getLogisticsEstimation_args:
861
class getLogisticsEstimation_args:
668
  """
862
  """
669
  Attributes:
863
  Attributes:
670
   - itemId
864
   - itemId
671
   - destination_pin
865
   - destination_pin