Subversion Repositories SmartDukaan

Rev

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

Rev 5185 Rev 5443
Line 139... Line 139...
139
     - itemId
139
     - itemId
140
     - quantity
140
     - quantity
141
    """
141
    """
142
    pass
142
    pass
143
 
143
 
-
 
144
  def getInvoices(self, date):
-
 
145
    """
-
 
146
    Fetches all invoices for a given date
-
 
147
 
-
 
148
    Parameters:
-
 
149
     - date
-
 
150
    """
-
 
151
    pass
-
 
152
 
-
 
153
  def createInvoice(self, invoice):
-
 
154
    """
-
 
155
    Creates an invoice object
-
 
156
 
-
 
157
    Parameters:
-
 
158
     - invoice
-
 
159
    """
-
 
160
    pass
-
 
161
 
144
 
162
 
145
class Client(shop2020.thriftpy.generic.GenericService.Client, Iface):
163
class Client(shop2020.thriftpy.generic.GenericService.Client, Iface):
146
  def __init__(self, iprot, oprot=None):
164
  def __init__(self, iprot, oprot=None):
147
    shop2020.thriftpy.generic.GenericService.Client.__init__(self, iprot, oprot)
165
    shop2020.thriftpy.generic.GenericService.Client.__init__(self, iprot, oprot)
148
 
166
 
Line 591... Line 609...
591
    self._iprot.readMessageEnd()
609
    self._iprot.readMessageEnd()
592
    if result.e is not None:
610
    if result.e is not None:
593
      raise result.e
611
      raise result.e
594
    return
612
    return
595
 
613
 
-
 
614
  def getInvoices(self, date):
-
 
615
    """
-
 
616
    Fetches all invoices for a given date
-
 
617
 
-
 
618
    Parameters:
-
 
619
     - date
-
 
620
    """
-
 
621
    self.send_getInvoices(date)
-
 
622
    return self.recv_getInvoices()
-
 
623
 
-
 
624
  def send_getInvoices(self, date):
-
 
625
    self._oprot.writeMessageBegin('getInvoices', TMessageType.CALL, self._seqid)
-
 
626
    args = getInvoices_args()
-
 
627
    args.date = date
-
 
628
    args.write(self._oprot)
-
 
629
    self._oprot.writeMessageEnd()
-
 
630
    self._oprot.trans.flush()
-
 
631
 
-
 
632
  def recv_getInvoices(self, ):
-
 
633
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
634
    if mtype == TMessageType.EXCEPTION:
-
 
635
      x = TApplicationException()
-
 
636
      x.read(self._iprot)
-
 
637
      self._iprot.readMessageEnd()
-
 
638
      raise x
-
 
639
    result = getInvoices_result()
-
 
640
    result.read(self._iprot)
-
 
641
    self._iprot.readMessageEnd()
-
 
642
    if result.success is not None:
-
 
643
      return result.success
-
 
644
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getInvoices failed: unknown result");
-
 
645
 
-
 
646
  def createInvoice(self, invoice):
-
 
647
    """
-
 
648
    Creates an invoice object
-
 
649
 
-
 
650
    Parameters:
-
 
651
     - invoice
-
 
652
    """
-
 
653
    self.send_createInvoice(invoice)
-
 
654
    self.recv_createInvoice()
-
 
655
 
-
 
656
  def send_createInvoice(self, invoice):
-
 
657
    self._oprot.writeMessageBegin('createInvoice', TMessageType.CALL, self._seqid)
-
 
658
    args = createInvoice_args()
-
 
659
    args.invoice = invoice
-
 
660
    args.write(self._oprot)
-
 
661
    self._oprot.writeMessageEnd()
-
 
662
    self._oprot.trans.flush()
-
 
663
 
-
 
664
  def recv_createInvoice(self, ):
-
 
665
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
666
    if mtype == TMessageType.EXCEPTION:
-
 
667
      x = TApplicationException()
-
 
668
      x.read(self._iprot)
-
 
669
      self._iprot.readMessageEnd()
-
 
670
      raise x
-
 
671
    result = createInvoice_result()
-
 
672
    result.read(self._iprot)
-
 
673
    self._iprot.readMessageEnd()
-
 
674
    if result.e is not None:
-
 
675
      raise result.e
-
 
676
    return
-
 
677
 
596
 
678
 
597
class Processor(shop2020.thriftpy.generic.GenericService.Processor, Iface, TProcessor):
679
class Processor(shop2020.thriftpy.generic.GenericService.Processor, Iface, TProcessor):
598
  def __init__(self, handler):
680
  def __init__(self, handler):
599
    shop2020.thriftpy.generic.GenericService.Processor.__init__(self, handler)
681
    shop2020.thriftpy.generic.GenericService.Processor.__init__(self, handler)
600
    self._processMap["createPurchaseOrder"] = Processor.process_createPurchaseOrder
682
    self._processMap["createPurchaseOrder"] = Processor.process_createPurchaseOrder
Line 608... Line 690...
608
    self._processMap["getPendingPurchaseOrders"] = Processor.process_getPendingPurchaseOrders
690
    self._processMap["getPendingPurchaseOrders"] = Processor.process_getPendingPurchaseOrders
609
    self._processMap["getSuppliers"] = Processor.process_getSuppliers
691
    self._processMap["getSuppliers"] = Processor.process_getSuppliers
610
    self._processMap["fulfillPO"] = Processor.process_fulfillPO
692
    self._processMap["fulfillPO"] = Processor.process_fulfillPO
611
    self._processMap["updatePurchaseOrder"] = Processor.process_updatePurchaseOrder
693
    self._processMap["updatePurchaseOrder"] = Processor.process_updatePurchaseOrder
612
    self._processMap["unFulfillPO"] = Processor.process_unFulfillPO
694
    self._processMap["unFulfillPO"] = Processor.process_unFulfillPO
-
 
695
    self._processMap["getInvoices"] = Processor.process_getInvoices
-
 
696
    self._processMap["createInvoice"] = Processor.process_createInvoice
613
 
697
 
614
  def process(self, iprot, oprot):
698
  def process(self, iprot, oprot):
615
    (name, type, seqid) = iprot.readMessageBegin()
699
    (name, type, seqid) = iprot.readMessageBegin()
616
    if name not in self._processMap:
700
    if name not in self._processMap:
617
      iprot.skip(TType.STRUCT)
701
      iprot.skip(TType.STRUCT)
Line 803... Line 887...
803
    oprot.writeMessageBegin("unFulfillPO", TMessageType.REPLY, seqid)
887
    oprot.writeMessageBegin("unFulfillPO", TMessageType.REPLY, seqid)
804
    result.write(oprot)
888
    result.write(oprot)
805
    oprot.writeMessageEnd()
889
    oprot.writeMessageEnd()
806
    oprot.trans.flush()
890
    oprot.trans.flush()
807
 
891
 
-
 
892
  def process_getInvoices(self, seqid, iprot, oprot):
-
 
893
    args = getInvoices_args()
-
 
894
    args.read(iprot)
-
 
895
    iprot.readMessageEnd()
-
 
896
    result = getInvoices_result()
-
 
897
    result.success = self._handler.getInvoices(args.date)
-
 
898
    oprot.writeMessageBegin("getInvoices", TMessageType.REPLY, seqid)
-
 
899
    result.write(oprot)
-
 
900
    oprot.writeMessageEnd()
-
 
901
    oprot.trans.flush()
-
 
902
 
-
 
903
  def process_createInvoice(self, seqid, iprot, oprot):
-
 
904
    args = createInvoice_args()
-
 
905
    args.read(iprot)
-
 
906
    iprot.readMessageEnd()
-
 
907
    result = createInvoice_result()
-
 
908
    try:
-
 
909
      self._handler.createInvoice(args.invoice)
-
 
910
    except PurchaseServiceException, e:
-
 
911
      result.e = e
-
 
912
    oprot.writeMessageBegin("createInvoice", TMessageType.REPLY, seqid)
-
 
913
    result.write(oprot)
-
 
914
    oprot.writeMessageEnd()
-
 
915
    oprot.trans.flush()
-
 
916
 
808
 
917
 
809
# HELPER FUNCTIONS AND STRUCTURES
918
# HELPER FUNCTIONS AND STRUCTURES
810
 
919
 
811
class createPurchaseOrder_args:
920
class createPurchaseOrder_args:
812
  """
921
  """
Line 2566... Line 2675...
2566
    if self.e is not None:
2675
    if self.e is not None:
2567
      oprot.writeFieldBegin('e', TType.STRUCT, 1)
2676
      oprot.writeFieldBegin('e', TType.STRUCT, 1)
2568
      self.e.write(oprot)
2677
      self.e.write(oprot)
2569
      oprot.writeFieldEnd()
2678
      oprot.writeFieldEnd()
2570
    oprot.writeFieldStop()
2679
    oprot.writeFieldStop()
-
 
2680
    oprot.writeStructEnd()
-
 
2681
 
-
 
2682
  def validate(self):
-
 
2683
    return
-
 
2684
 
-
 
2685
 
-
 
2686
  def __repr__(self):
-
 
2687
    L = ['%s=%r' % (key, value)
-
 
2688
      for key, value in self.__dict__.iteritems()]
-
 
2689
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
2690
 
-
 
2691
  def __eq__(self, other):
-
 
2692
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
2693
 
-
 
2694
  def __ne__(self, other):
-
 
2695
    return not (self == other)
-
 
2696
 
-
 
2697
class getInvoices_args:
-
 
2698
  """
-
 
2699
  Attributes:
-
 
2700
   - date
-
 
2701
  """
-
 
2702
 
-
 
2703
  thrift_spec = (
-
 
2704
    None, # 0
-
 
2705
    (1, TType.I64, 'date', None, None, ), # 1
-
 
2706
  )
-
 
2707
 
-
 
2708
  def __init__(self, date=None,):
-
 
2709
    self.date = date
-
 
2710
 
-
 
2711
  def read(self, iprot):
-
 
2712
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
2713
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
2714
      return
-
 
2715
    iprot.readStructBegin()
-
 
2716
    while True:
-
 
2717
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
2718
      if ftype == TType.STOP:
-
 
2719
        break
-
 
2720
      if fid == 1:
-
 
2721
        if ftype == TType.I64:
-
 
2722
          self.date = iprot.readI64();
-
 
2723
        else:
-
 
2724
          iprot.skip(ftype)
-
 
2725
      else:
-
 
2726
        iprot.skip(ftype)
-
 
2727
      iprot.readFieldEnd()
-
 
2728
    iprot.readStructEnd()
-
 
2729
 
-
 
2730
  def write(self, oprot):
-
 
2731
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
2732
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
2733
      return
-
 
2734
    oprot.writeStructBegin('getInvoices_args')
-
 
2735
    if self.date is not None:
-
 
2736
      oprot.writeFieldBegin('date', TType.I64, 1)
-
 
2737
      oprot.writeI64(self.date)
-
 
2738
      oprot.writeFieldEnd()
-
 
2739
    oprot.writeFieldStop()
-
 
2740
    oprot.writeStructEnd()
-
 
2741
 
-
 
2742
  def validate(self):
-
 
2743
    return
-
 
2744
 
-
 
2745
 
-
 
2746
  def __repr__(self):
-
 
2747
    L = ['%s=%r' % (key, value)
-
 
2748
      for key, value in self.__dict__.iteritems()]
-
 
2749
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
2750
 
-
 
2751
  def __eq__(self, other):
-
 
2752
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
2753
 
-
 
2754
  def __ne__(self, other):
-
 
2755
    return not (self == other)
-
 
2756
 
-
 
2757
class getInvoices_result:
-
 
2758
  """
-
 
2759
  Attributes:
-
 
2760
   - success
-
 
2761
  """
-
 
2762
 
-
 
2763
  thrift_spec = (
-
 
2764
    (0, TType.LIST, 'success', (TType.STRUCT,(Invoice, Invoice.thrift_spec)), None, ), # 0
-
 
2765
  )
-
 
2766
 
-
 
2767
  def __init__(self, success=None,):
-
 
2768
    self.success = success
-
 
2769
 
-
 
2770
  def read(self, iprot):
-
 
2771
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
2772
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
2773
      return
-
 
2774
    iprot.readStructBegin()
-
 
2775
    while True:
-
 
2776
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
2777
      if ftype == TType.STOP:
-
 
2778
        break
-
 
2779
      if fid == 0:
-
 
2780
        if ftype == TType.LIST:
-
 
2781
          self.success = []
-
 
2782
          (_etype38, _size35) = iprot.readListBegin()
-
 
2783
          for _i39 in xrange(_size35):
-
 
2784
            _elem40 = Invoice()
-
 
2785
            _elem40.read(iprot)
-
 
2786
            self.success.append(_elem40)
-
 
2787
          iprot.readListEnd()
-
 
2788
        else:
-
 
2789
          iprot.skip(ftype)
-
 
2790
      else:
-
 
2791
        iprot.skip(ftype)
-
 
2792
      iprot.readFieldEnd()
-
 
2793
    iprot.readStructEnd()
-
 
2794
 
-
 
2795
  def write(self, oprot):
-
 
2796
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
2797
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
2798
      return
-
 
2799
    oprot.writeStructBegin('getInvoices_result')
-
 
2800
    if self.success is not None:
-
 
2801
      oprot.writeFieldBegin('success', TType.LIST, 0)
-
 
2802
      oprot.writeListBegin(TType.STRUCT, len(self.success))
-
 
2803
      for iter41 in self.success:
-
 
2804
        iter41.write(oprot)
-
 
2805
      oprot.writeListEnd()
-
 
2806
      oprot.writeFieldEnd()
-
 
2807
    oprot.writeFieldStop()
-
 
2808
    oprot.writeStructEnd()
-
 
2809
 
-
 
2810
  def validate(self):
-
 
2811
    return
-
 
2812
 
-
 
2813
 
-
 
2814
  def __repr__(self):
-
 
2815
    L = ['%s=%r' % (key, value)
-
 
2816
      for key, value in self.__dict__.iteritems()]
-
 
2817
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
2818
 
-
 
2819
  def __eq__(self, other):
-
 
2820
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
2821
 
-
 
2822
  def __ne__(self, other):
-
 
2823
    return not (self == other)
-
 
2824
 
-
 
2825
class createInvoice_args:
-
 
2826
  """
-
 
2827
  Attributes:
-
 
2828
   - invoice
-
 
2829
  """
-
 
2830
 
-
 
2831
  thrift_spec = (
-
 
2832
    None, # 0
-
 
2833
    (1, TType.STRUCT, 'invoice', (Invoice, Invoice.thrift_spec), None, ), # 1
-
 
2834
  )
-
 
2835
 
-
 
2836
  def __init__(self, invoice=None,):
-
 
2837
    self.invoice = invoice
-
 
2838
 
-
 
2839
  def read(self, iprot):
-
 
2840
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
2841
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
2842
      return
-
 
2843
    iprot.readStructBegin()
-
 
2844
    while True:
-
 
2845
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
2846
      if ftype == TType.STOP:
-
 
2847
        break
-
 
2848
      if fid == 1:
-
 
2849
        if ftype == TType.STRUCT:
-
 
2850
          self.invoice = Invoice()
-
 
2851
          self.invoice.read(iprot)
-
 
2852
        else:
-
 
2853
          iprot.skip(ftype)
-
 
2854
      else:
-
 
2855
        iprot.skip(ftype)
-
 
2856
      iprot.readFieldEnd()
-
 
2857
    iprot.readStructEnd()
-
 
2858
 
-
 
2859
  def write(self, oprot):
-
 
2860
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
2861
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
2862
      return
-
 
2863
    oprot.writeStructBegin('createInvoice_args')
-
 
2864
    if self.invoice is not None:
-
 
2865
      oprot.writeFieldBegin('invoice', TType.STRUCT, 1)
-
 
2866
      self.invoice.write(oprot)
-
 
2867
      oprot.writeFieldEnd()
-
 
2868
    oprot.writeFieldStop()
-
 
2869
    oprot.writeStructEnd()
-
 
2870
 
-
 
2871
  def validate(self):
-
 
2872
    return
-
 
2873
 
-
 
2874
 
-
 
2875
  def __repr__(self):
-
 
2876
    L = ['%s=%r' % (key, value)
-
 
2877
      for key, value in self.__dict__.iteritems()]
-
 
2878
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
2879
 
-
 
2880
  def __eq__(self, other):
-
 
2881
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
2882
 
-
 
2883
  def __ne__(self, other):
-
 
2884
    return not (self == other)
-
 
2885
 
-
 
2886
class createInvoice_result:
-
 
2887
  """
-
 
2888
  Attributes:
-
 
2889
   - e
-
 
2890
  """
-
 
2891
 
-
 
2892
  thrift_spec = (
-
 
2893
    None, # 0
-
 
2894
    (1, TType.STRUCT, 'e', (PurchaseServiceException, PurchaseServiceException.thrift_spec), None, ), # 1
-
 
2895
  )
-
 
2896
 
-
 
2897
  def __init__(self, e=None,):
-
 
2898
    self.e = e
-
 
2899
 
-
 
2900
  def read(self, iprot):
-
 
2901
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
2902
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
2903
      return
-
 
2904
    iprot.readStructBegin()
-
 
2905
    while True:
-
 
2906
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
2907
      if ftype == TType.STOP:
-
 
2908
        break
-
 
2909
      if fid == 1:
-
 
2910
        if ftype == TType.STRUCT:
-
 
2911
          self.e = PurchaseServiceException()
-
 
2912
          self.e.read(iprot)
-
 
2913
        else:
-
 
2914
          iprot.skip(ftype)
-
 
2915
      else:
-
 
2916
        iprot.skip(ftype)
-
 
2917
      iprot.readFieldEnd()
-
 
2918
    iprot.readStructEnd()
-
 
2919
 
-
 
2920
  def write(self, oprot):
-
 
2921
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
2922
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
2923
      return
-
 
2924
    oprot.writeStructBegin('createInvoice_result')
-
 
2925
    if self.e is not None:
-
 
2926
      oprot.writeFieldBegin('e', TType.STRUCT, 1)
-
 
2927
      self.e.write(oprot)
-
 
2928
      oprot.writeFieldEnd()
-
 
2929
    oprot.writeFieldStop()
2571
    oprot.writeStructEnd()
2930
    oprot.writeStructEnd()
2572
 
2931
 
2573
  def validate(self):
2932
  def validate(self):
2574
    return
2933
    return
2575
 
2934