Subversion Repositories SmartDukaan

Rev

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

Rev 2616 Rev 2690
Line 454... Line 454...
454
    Parameters:
454
    Parameters:
455
     - orderId
455
     - orderId
456
    """
456
    """
457
    pass
457
    pass
458
 
458
 
-
 
459
  def getReturnOrders(self, warehouseId, fromDate, toDate):
-
 
460
    """
-
 
461
    Get all return orders created between the from and to dates for the given warehouse.
-
 
462
    Ignores the warehouse if it is passed as -1.
-
 
463
    
-
 
464
    Parameters:
-
 
465
     - warehouseId
-
 
466
     - fromDate
-
 
467
     - toDate
-
 
468
    """
-
 
469
    pass
-
 
470
 
-
 
471
  def processReturn(self, returnOrderId):
-
 
472
    """
-
 
473
    Marks the return order with the given id as processed. Raises an exception if no such return order exists.
-
 
474
    
-
 
475
    Parameters:
-
 
476
     - returnOrderId
-
 
477
    """
-
 
478
    pass
-
 
479
 
459
 
480
 
460
class Client(Iface):
481
class Client(Iface):
461
  def __init__(self, iprot, oprot=None):
482
  def __init__(self, iprot, oprot=None):
462
    self._iprot = self._oprot = iprot
483
    self._iprot = self._oprot = iprot
463
    if oprot != None:
484
    if oprot != None:
Line 2007... Line 2028...
2007
      return result.success
2028
      return result.success
2008
    if result.ex != None:
2029
    if result.ex != None:
2009
      raise result.ex
2030
      raise result.ex
2010
    raise TApplicationException(TApplicationException.MISSING_RESULT, "refundOrder failed: unknown result");
2031
    raise TApplicationException(TApplicationException.MISSING_RESULT, "refundOrder failed: unknown result");
2011
 
2032
 
-
 
2033
  def getReturnOrders(self, warehouseId, fromDate, toDate):
-
 
2034
    """
-
 
2035
    Get all return orders created between the from and to dates for the given warehouse.
-
 
2036
    Ignores the warehouse if it is passed as -1.
-
 
2037
    
-
 
2038
    Parameters:
-
 
2039
     - warehouseId
-
 
2040
     - fromDate
-
 
2041
     - toDate
-
 
2042
    """
-
 
2043
    self.send_getReturnOrders(warehouseId, fromDate, toDate)
-
 
2044
    return self.recv_getReturnOrders()
-
 
2045
 
-
 
2046
  def send_getReturnOrders(self, warehouseId, fromDate, toDate):
-
 
2047
    self._oprot.writeMessageBegin('getReturnOrders', TMessageType.CALL, self._seqid)
-
 
2048
    args = getReturnOrders_args()
-
 
2049
    args.warehouseId = warehouseId
-
 
2050
    args.fromDate = fromDate
-
 
2051
    args.toDate = toDate
-
 
2052
    args.write(self._oprot)
-
 
2053
    self._oprot.writeMessageEnd()
-
 
2054
    self._oprot.trans.flush()
-
 
2055
 
-
 
2056
  def recv_getReturnOrders(self, ):
-
 
2057
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
2058
    if mtype == TMessageType.EXCEPTION:
-
 
2059
      x = TApplicationException()
-
 
2060
      x.read(self._iprot)
-
 
2061
      self._iprot.readMessageEnd()
-
 
2062
      raise x
-
 
2063
    result = getReturnOrders_result()
-
 
2064
    result.read(self._iprot)
-
 
2065
    self._iprot.readMessageEnd()
-
 
2066
    if result.success != None:
-
 
2067
      return result.success
-
 
2068
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getReturnOrders failed: unknown result");
-
 
2069
 
-
 
2070
  def processReturn(self, returnOrderId):
-
 
2071
    """
-
 
2072
    Marks the return order with the given id as processed. Raises an exception if no such return order exists.
-
 
2073
    
-
 
2074
    Parameters:
-
 
2075
     - returnOrderId
-
 
2076
    """
-
 
2077
    self.send_processReturn(returnOrderId)
-
 
2078
    self.recv_processReturn()
-
 
2079
 
-
 
2080
  def send_processReturn(self, returnOrderId):
-
 
2081
    self._oprot.writeMessageBegin('processReturn', TMessageType.CALL, self._seqid)
-
 
2082
    args = processReturn_args()
-
 
2083
    args.returnOrderId = returnOrderId
-
 
2084
    args.write(self._oprot)
-
 
2085
    self._oprot.writeMessageEnd()
-
 
2086
    self._oprot.trans.flush()
-
 
2087
 
-
 
2088
  def recv_processReturn(self, ):
-
 
2089
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
2090
    if mtype == TMessageType.EXCEPTION:
-
 
2091
      x = TApplicationException()
-
 
2092
      x.read(self._iprot)
-
 
2093
      self._iprot.readMessageEnd()
-
 
2094
      raise x
-
 
2095
    result = processReturn_result()
-
 
2096
    result.read(self._iprot)
-
 
2097
    self._iprot.readMessageEnd()
-
 
2098
    if result.ex != None:
-
 
2099
      raise result.ex
-
 
2100
    return
-
 
2101
 
2012
 
2102
 
2013
class Processor(Iface, TProcessor):
2103
class Processor(Iface, TProcessor):
2014
  def __init__(self, handler):
2104
  def __init__(self, handler):
2015
    self._handler = handler
2105
    self._handler = handler
2016
    self._processMap = {}
2106
    self._processMap = {}
Line 2056... Line 2146...
2056
    self._processMap["authorizePickup"] = Processor.process_authorizePickup
2146
    self._processMap["authorizePickup"] = Processor.process_authorizePickup
2057
    self._processMap["receiveReturn"] = Processor.process_receiveReturn
2147
    self._processMap["receiveReturn"] = Processor.process_receiveReturn
2058
    self._processMap["validateDoa"] = Processor.process_validateDoa
2148
    self._processMap["validateDoa"] = Processor.process_validateDoa
2059
    self._processMap["reshipOrder"] = Processor.process_reshipOrder
2149
    self._processMap["reshipOrder"] = Processor.process_reshipOrder
2060
    self._processMap["refundOrder"] = Processor.process_refundOrder
2150
    self._processMap["refundOrder"] = Processor.process_refundOrder
-
 
2151
    self._processMap["getReturnOrders"] = Processor.process_getReturnOrders
-
 
2152
    self._processMap["processReturn"] = Processor.process_processReturn
2061
 
2153
 
2062
  def process(self, iprot, oprot):
2154
  def process(self, iprot, oprot):
2063
    (name, type, seqid) = iprot.readMessageBegin()
2155
    (name, type, seqid) = iprot.readMessageBegin()
2064
    if name not in self._processMap:
2156
    if name not in self._processMap:
2065
      iprot.skip(TType.STRUCT)
2157
      iprot.skip(TType.STRUCT)
Line 2664... Line 2756...
2664
    oprot.writeMessageBegin("refundOrder", TMessageType.REPLY, seqid)
2756
    oprot.writeMessageBegin("refundOrder", TMessageType.REPLY, seqid)
2665
    result.write(oprot)
2757
    result.write(oprot)
2666
    oprot.writeMessageEnd()
2758
    oprot.writeMessageEnd()
2667
    oprot.trans.flush()
2759
    oprot.trans.flush()
2668
 
2760
 
-
 
2761
  def process_getReturnOrders(self, seqid, iprot, oprot):
-
 
2762
    args = getReturnOrders_args()
-
 
2763
    args.read(iprot)
-
 
2764
    iprot.readMessageEnd()
-
 
2765
    result = getReturnOrders_result()
-
 
2766
    result.success = self._handler.getReturnOrders(args.warehouseId, args.fromDate, args.toDate)
-
 
2767
    oprot.writeMessageBegin("getReturnOrders", TMessageType.REPLY, seqid)
-
 
2768
    result.write(oprot)
-
 
2769
    oprot.writeMessageEnd()
-
 
2770
    oprot.trans.flush()
-
 
2771
 
-
 
2772
  def process_processReturn(self, seqid, iprot, oprot):
-
 
2773
    args = processReturn_args()
-
 
2774
    args.read(iprot)
-
 
2775
    iprot.readMessageEnd()
-
 
2776
    result = processReturn_result()
-
 
2777
    try:
-
 
2778
      self._handler.processReturn(args.returnOrderId)
-
 
2779
    except TransactionServiceException, ex:
-
 
2780
      result.ex = ex
-
 
2781
    oprot.writeMessageBegin("processReturn", TMessageType.REPLY, seqid)
-
 
2782
    result.write(oprot)
-
 
2783
    oprot.writeMessageEnd()
-
 
2784
    oprot.trans.flush()
-
 
2785
 
2669
 
2786
 
2670
# HELPER FUNCTIONS AND STRUCTURES
2787
# HELPER FUNCTIONS AND STRUCTURES
2671
 
2788
 
2672
class closeSession_args:
2789
class closeSession_args:
2673
 
2790
 
Line 8464... Line 8581...
8464
    if self.ex != None:
8581
    if self.ex != None:
8465
      oprot.writeFieldBegin('ex', TType.STRUCT, 1)
8582
      oprot.writeFieldBegin('ex', TType.STRUCT, 1)
8466
      self.ex.write(oprot)
8583
      self.ex.write(oprot)
8467
      oprot.writeFieldEnd()
8584
      oprot.writeFieldEnd()
8468
    oprot.writeFieldStop()
8585
    oprot.writeFieldStop()
-
 
8586
    oprot.writeStructEnd()
-
 
8587
 
-
 
8588
  def __repr__(self):
-
 
8589
    L = ['%s=%r' % (key, value)
-
 
8590
      for key, value in self.__dict__.iteritems()]
-
 
8591
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
8592
 
-
 
8593
  def __eq__(self, other):
-
 
8594
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
8595
 
-
 
8596
  def __ne__(self, other):
-
 
8597
    return not (self == other)
-
 
8598
 
-
 
8599
class getReturnOrders_args:
-
 
8600
  """
-
 
8601
  Attributes:
-
 
8602
   - warehouseId
-
 
8603
   - fromDate
-
 
8604
   - toDate
-
 
8605
  """
-
 
8606
 
-
 
8607
  thrift_spec = (
-
 
8608
    None, # 0
-
 
8609
    (1, TType.I64, 'warehouseId', None, None, ), # 1
-
 
8610
    (2, TType.I64, 'fromDate', None, None, ), # 2
-
 
8611
    (3, TType.I64, 'toDate', None, None, ), # 3
-
 
8612
  )
-
 
8613
 
-
 
8614
  def __init__(self, warehouseId=None, fromDate=None, toDate=None,):
-
 
8615
    self.warehouseId = warehouseId
-
 
8616
    self.fromDate = fromDate
-
 
8617
    self.toDate = toDate
-
 
8618
 
-
 
8619
  def read(self, iprot):
-
 
8620
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
8621
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
8622
      return
-
 
8623
    iprot.readStructBegin()
-
 
8624
    while True:
-
 
8625
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
8626
      if ftype == TType.STOP:
-
 
8627
        break
-
 
8628
      if fid == 1:
-
 
8629
        if ftype == TType.I64:
-
 
8630
          self.warehouseId = iprot.readI64();
-
 
8631
        else:
-
 
8632
          iprot.skip(ftype)
-
 
8633
      elif fid == 2:
-
 
8634
        if ftype == TType.I64:
-
 
8635
          self.fromDate = iprot.readI64();
-
 
8636
        else:
-
 
8637
          iprot.skip(ftype)
-
 
8638
      elif fid == 3:
-
 
8639
        if ftype == TType.I64:
-
 
8640
          self.toDate = iprot.readI64();
-
 
8641
        else:
-
 
8642
          iprot.skip(ftype)
-
 
8643
      else:
-
 
8644
        iprot.skip(ftype)
-
 
8645
      iprot.readFieldEnd()
-
 
8646
    iprot.readStructEnd()
-
 
8647
 
-
 
8648
  def write(self, oprot):
-
 
8649
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
8650
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
8651
      return
-
 
8652
    oprot.writeStructBegin('getReturnOrders_args')
-
 
8653
    if self.warehouseId != None:
-
 
8654
      oprot.writeFieldBegin('warehouseId', TType.I64, 1)
-
 
8655
      oprot.writeI64(self.warehouseId)
-
 
8656
      oprot.writeFieldEnd()
-
 
8657
    if self.fromDate != None:
-
 
8658
      oprot.writeFieldBegin('fromDate', TType.I64, 2)
-
 
8659
      oprot.writeI64(self.fromDate)
-
 
8660
      oprot.writeFieldEnd()
-
 
8661
    if self.toDate != None:
-
 
8662
      oprot.writeFieldBegin('toDate', TType.I64, 3)
-
 
8663
      oprot.writeI64(self.toDate)
-
 
8664
      oprot.writeFieldEnd()
-
 
8665
    oprot.writeFieldStop()
-
 
8666
    oprot.writeStructEnd()
-
 
8667
 
-
 
8668
  def __repr__(self):
-
 
8669
    L = ['%s=%r' % (key, value)
-
 
8670
      for key, value in self.__dict__.iteritems()]
-
 
8671
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
8672
 
-
 
8673
  def __eq__(self, other):
-
 
8674
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
8675
 
-
 
8676
  def __ne__(self, other):
-
 
8677
    return not (self == other)
-
 
8678
 
-
 
8679
class getReturnOrders_result:
-
 
8680
  """
-
 
8681
  Attributes:
-
 
8682
   - success
-
 
8683
  """
-
 
8684
 
-
 
8685
  thrift_spec = (
-
 
8686
    (0, TType.LIST, 'success', (TType.STRUCT,(ReturnOrder, ReturnOrder.thrift_spec)), None, ), # 0
-
 
8687
  )
-
 
8688
 
-
 
8689
  def __init__(self, success=None,):
-
 
8690
    self.success = success
-
 
8691
 
-
 
8692
  def read(self, iprot):
-
 
8693
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
8694
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
8695
      return
-
 
8696
    iprot.readStructBegin()
-
 
8697
    while True:
-
 
8698
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
8699
      if ftype == TType.STOP:
-
 
8700
        break
-
 
8701
      if fid == 0:
-
 
8702
        if ftype == TType.LIST:
-
 
8703
          self.success = []
-
 
8704
          (_etype158, _size155) = iprot.readListBegin()
-
 
8705
          for _i159 in xrange(_size155):
-
 
8706
            _elem160 = ReturnOrder()
-
 
8707
            _elem160.read(iprot)
-
 
8708
            self.success.append(_elem160)
-
 
8709
          iprot.readListEnd()
-
 
8710
        else:
-
 
8711
          iprot.skip(ftype)
-
 
8712
      else:
-
 
8713
        iprot.skip(ftype)
-
 
8714
      iprot.readFieldEnd()
-
 
8715
    iprot.readStructEnd()
-
 
8716
 
-
 
8717
  def write(self, oprot):
-
 
8718
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
8719
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
8720
      return
-
 
8721
    oprot.writeStructBegin('getReturnOrders_result')
-
 
8722
    if self.success != None:
-
 
8723
      oprot.writeFieldBegin('success', TType.LIST, 0)
-
 
8724
      oprot.writeListBegin(TType.STRUCT, len(self.success))
-
 
8725
      for iter161 in self.success:
-
 
8726
        iter161.write(oprot)
-
 
8727
      oprot.writeListEnd()
-
 
8728
      oprot.writeFieldEnd()
-
 
8729
    oprot.writeFieldStop()
-
 
8730
    oprot.writeStructEnd()
-
 
8731
 
-
 
8732
  def __repr__(self):
-
 
8733
    L = ['%s=%r' % (key, value)
-
 
8734
      for key, value in self.__dict__.iteritems()]
-
 
8735
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
8736
 
-
 
8737
  def __eq__(self, other):
-
 
8738
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
8739
 
-
 
8740
  def __ne__(self, other):
-
 
8741
    return not (self == other)
-
 
8742
 
-
 
8743
class processReturn_args:
-
 
8744
  """
-
 
8745
  Attributes:
-
 
8746
   - returnOrderId
-
 
8747
  """
-
 
8748
 
-
 
8749
  thrift_spec = (
-
 
8750
    None, # 0
-
 
8751
    (1, TType.I64, 'returnOrderId', None, None, ), # 1
-
 
8752
  )
-
 
8753
 
-
 
8754
  def __init__(self, returnOrderId=None,):
-
 
8755
    self.returnOrderId = returnOrderId
-
 
8756
 
-
 
8757
  def read(self, iprot):
-
 
8758
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
8759
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
8760
      return
-
 
8761
    iprot.readStructBegin()
-
 
8762
    while True:
-
 
8763
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
8764
      if ftype == TType.STOP:
-
 
8765
        break
-
 
8766
      if fid == 1:
-
 
8767
        if ftype == TType.I64:
-
 
8768
          self.returnOrderId = iprot.readI64();
-
 
8769
        else:
-
 
8770
          iprot.skip(ftype)
-
 
8771
      else:
-
 
8772
        iprot.skip(ftype)
-
 
8773
      iprot.readFieldEnd()
-
 
8774
    iprot.readStructEnd()
-
 
8775
 
-
 
8776
  def write(self, oprot):
-
 
8777
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
8778
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
8779
      return
-
 
8780
    oprot.writeStructBegin('processReturn_args')
-
 
8781
    if self.returnOrderId != None:
-
 
8782
      oprot.writeFieldBegin('returnOrderId', TType.I64, 1)
-
 
8783
      oprot.writeI64(self.returnOrderId)
-
 
8784
      oprot.writeFieldEnd()
-
 
8785
    oprot.writeFieldStop()
-
 
8786
    oprot.writeStructEnd()
-
 
8787
 
-
 
8788
  def __repr__(self):
-
 
8789
    L = ['%s=%r' % (key, value)
-
 
8790
      for key, value in self.__dict__.iteritems()]
-
 
8791
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
8792
 
-
 
8793
  def __eq__(self, other):
-
 
8794
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
8795
 
-
 
8796
  def __ne__(self, other):
-
 
8797
    return not (self == other)
-
 
8798
 
-
 
8799
class processReturn_result:
-
 
8800
  """
-
 
8801
  Attributes:
-
 
8802
   - ex
-
 
8803
  """
-
 
8804
 
-
 
8805
  thrift_spec = (
-
 
8806
    None, # 0
-
 
8807
    (1, TType.STRUCT, 'ex', (TransactionServiceException, TransactionServiceException.thrift_spec), None, ), # 1
-
 
8808
  )
-
 
8809
 
-
 
8810
  def __init__(self, ex=None,):
-
 
8811
    self.ex = ex
-
 
8812
 
-
 
8813
  def read(self, iprot):
-
 
8814
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
8815
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
8816
      return
-
 
8817
    iprot.readStructBegin()
-
 
8818
    while True:
-
 
8819
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
8820
      if ftype == TType.STOP:
-
 
8821
        break
-
 
8822
      if fid == 1:
-
 
8823
        if ftype == TType.STRUCT:
-
 
8824
          self.ex = TransactionServiceException()
-
 
8825
          self.ex.read(iprot)
-
 
8826
        else:
-
 
8827
          iprot.skip(ftype)
-
 
8828
      else:
-
 
8829
        iprot.skip(ftype)
-
 
8830
      iprot.readFieldEnd()
-
 
8831
    iprot.readStructEnd()
-
 
8832
 
-
 
8833
  def write(self, oprot):
-
 
8834
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
8835
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
8836
      return
-
 
8837
    oprot.writeStructBegin('processReturn_result')
-
 
8838
    if self.ex != None:
-
 
8839
      oprot.writeFieldBegin('ex', TType.STRUCT, 1)
-
 
8840
      self.ex.write(oprot)
-
 
8841
      oprot.writeFieldEnd()
-
 
8842
    oprot.writeFieldStop()
8469
    oprot.writeStructEnd()
8843
    oprot.writeStructEnd()
8470
 
8844
 
8471
  def __repr__(self):
8845
  def __repr__(self):
8472
    L = ['%s=%r' % (key, value)
8846
    L = ['%s=%r' % (key, value)
8473
      for key, value in self.__dict__.iteritems()]
8847
      for key, value in self.__dict__.iteritems()]