Subversion Repositories SmartDukaan

Rev

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

Rev 3616 Rev 3956
Line 156... Line 156...
156
    Parameters:
156
    Parameters:
157
     - merchantTxnId
157
     - merchantTxnId
158
    """
158
    """
159
    pass
159
    pass
160
 
160
 
-
 
161
  def partiallyCapturePayment(self, merchantTxnId, amount, xferBy, xferTxnId, xferDate):
-
 
162
    """
-
 
163
    Adds the given amount to the captured amount of a COD payment.
-
 
164
    Updates the captured amount for the corresponding payment and marks it as PARTIALLY CAPTURED.
-
 
165
    If the captured amount becomes equal to total amount, then the payment status is set as SUCCESS.
-
 
166
    Also sets the name of the entity which transferred the money, the date on which it was transferred
-
 
167
    and the corresponding transaction id.
-
 
168
 
-
 
169
    Returns false if the payment couldn't be captured.
-
 
170
    Throws exception if no such payment could be found or if the captured amount will exceed the total amount after capturing.
-
 
171
 
-
 
172
    Parameters:
-
 
173
     - merchantTxnId
-
 
174
     - amount
-
 
175
     - xferBy
-
 
176
     - xferTxnId
-
 
177
     - xferDate
-
 
178
    """
-
 
179
    pass
-
 
180
 
161
 
181
 
162
class Client(shop2020.thriftpy.generic.GenericService.Client, Iface):
182
class Client(shop2020.thriftpy.generic.GenericService.Client, Iface):
163
  def __init__(self, iprot, oprot=None):
183
  def __init__(self, iprot, oprot=None):
164
    shop2020.thriftpy.generic.GenericService.Client.__init__(self, iprot, oprot)
184
    shop2020.thriftpy.generic.GenericService.Client.__init__(self, iprot, oprot)
165
 
185
 
Line 622... Line 642...
622
      return result.success
642
      return result.success
623
    if result.pe is not None:
643
    if result.pe is not None:
624
      raise result.pe
644
      raise result.pe
625
    raise TApplicationException(TApplicationException.MISSING_RESULT, "capturePayment failed: unknown result");
645
    raise TApplicationException(TApplicationException.MISSING_RESULT, "capturePayment failed: unknown result");
626
 
646
 
-
 
647
  def partiallyCapturePayment(self, merchantTxnId, amount, xferBy, xferTxnId, xferDate):
-
 
648
    """
-
 
649
    Adds the given amount to the captured amount of a COD payment.
-
 
650
    Updates the captured amount for the corresponding payment and marks it as PARTIALLY CAPTURED.
-
 
651
    If the captured amount becomes equal to total amount, then the payment status is set as SUCCESS.
-
 
652
    Also sets the name of the entity which transferred the money, the date on which it was transferred
-
 
653
    and the corresponding transaction id.
-
 
654
 
-
 
655
    Returns false if the payment couldn't be captured.
-
 
656
    Throws exception if no such payment could be found or if the captured amount will exceed the total amount after capturing.
-
 
657
 
-
 
658
    Parameters:
-
 
659
     - merchantTxnId
-
 
660
     - amount
-
 
661
     - xferBy
-
 
662
     - xferTxnId
-
 
663
     - xferDate
-
 
664
    """
-
 
665
    self.send_partiallyCapturePayment(merchantTxnId, amount, xferBy, xferTxnId, xferDate)
-
 
666
    return self.recv_partiallyCapturePayment()
-
 
667
 
-
 
668
  def send_partiallyCapturePayment(self, merchantTxnId, amount, xferBy, xferTxnId, xferDate):
-
 
669
    self._oprot.writeMessageBegin('partiallyCapturePayment', TMessageType.CALL, self._seqid)
-
 
670
    args = partiallyCapturePayment_args()
-
 
671
    args.merchantTxnId = merchantTxnId
-
 
672
    args.amount = amount
-
 
673
    args.xferBy = xferBy
-
 
674
    args.xferTxnId = xferTxnId
-
 
675
    args.xferDate = xferDate
-
 
676
    args.write(self._oprot)
-
 
677
    self._oprot.writeMessageEnd()
-
 
678
    self._oprot.trans.flush()
-
 
679
 
-
 
680
  def recv_partiallyCapturePayment(self, ):
-
 
681
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
682
    if mtype == TMessageType.EXCEPTION:
-
 
683
      x = TApplicationException()
-
 
684
      x.read(self._iprot)
-
 
685
      self._iprot.readMessageEnd()
-
 
686
      raise x
-
 
687
    result = partiallyCapturePayment_result()
-
 
688
    result.read(self._iprot)
-
 
689
    self._iprot.readMessageEnd()
-
 
690
    if result.success is not None:
-
 
691
      return result.success
-
 
692
    if result.pe is not None:
-
 
693
      raise result.pe
-
 
694
    raise TApplicationException(TApplicationException.MISSING_RESULT, "partiallyCapturePayment failed: unknown result");
-
 
695
 
627
 
696
 
628
class Processor(shop2020.thriftpy.generic.GenericService.Processor, Iface, TProcessor):
697
class Processor(shop2020.thriftpy.generic.GenericService.Processor, Iface, TProcessor):
629
  def __init__(self, handler):
698
  def __init__(self, handler):
630
    shop2020.thriftpy.generic.GenericService.Processor.__init__(self, handler)
699
    shop2020.thriftpy.generic.GenericService.Processor.__init__(self, handler)
631
    self._processMap["createPayment"] = Processor.process_createPayment
700
    self._processMap["createPayment"] = Processor.process_createPayment
Line 638... Line 707...
638
    self._processMap["getSuccessfulPaymentsAmountRange"] = Processor.process_getSuccessfulPaymentsAmountRange
707
    self._processMap["getSuccessfulPaymentsAmountRange"] = Processor.process_getSuccessfulPaymentsAmountRange
639
    self._processMap["initializeHdfcPayment"] = Processor.process_initializeHdfcPayment
708
    self._processMap["initializeHdfcPayment"] = Processor.process_initializeHdfcPayment
640
    self._processMap["initializeHdfcEmiPayment"] = Processor.process_initializeHdfcEmiPayment
709
    self._processMap["initializeHdfcEmiPayment"] = Processor.process_initializeHdfcEmiPayment
641
    self._processMap["createRefund"] = Processor.process_createRefund
710
    self._processMap["createRefund"] = Processor.process_createRefund
642
    self._processMap["capturePayment"] = Processor.process_capturePayment
711
    self._processMap["capturePayment"] = Processor.process_capturePayment
-
 
712
    self._processMap["partiallyCapturePayment"] = Processor.process_partiallyCapturePayment
643
 
713
 
644
  def process(self, iprot, oprot):
714
  def process(self, iprot, oprot):
645
    (name, type, seqid) = iprot.readMessageBegin()
715
    (name, type, seqid) = iprot.readMessageBegin()
646
    if name not in self._processMap:
716
    if name not in self._processMap:
647
      iprot.skip(TType.STRUCT)
717
      iprot.skip(TType.STRUCT)
Line 819... Line 889...
819
    oprot.writeMessageBegin("capturePayment", TMessageType.REPLY, seqid)
889
    oprot.writeMessageBegin("capturePayment", TMessageType.REPLY, seqid)
820
    result.write(oprot)
890
    result.write(oprot)
821
    oprot.writeMessageEnd()
891
    oprot.writeMessageEnd()
822
    oprot.trans.flush()
892
    oprot.trans.flush()
823
 
893
 
-
 
894
  def process_partiallyCapturePayment(self, seqid, iprot, oprot):
-
 
895
    args = partiallyCapturePayment_args()
-
 
896
    args.read(iprot)
-
 
897
    iprot.readMessageEnd()
-
 
898
    result = partiallyCapturePayment_result()
-
 
899
    try:
-
 
900
      result.success = self._handler.partiallyCapturePayment(args.merchantTxnId, args.amount, args.xferBy, args.xferTxnId, args.xferDate)
-
 
901
    except PaymentException, pe:
-
 
902
      result.pe = pe
-
 
903
    oprot.writeMessageBegin("partiallyCapturePayment", TMessageType.REPLY, seqid)
-
 
904
    result.write(oprot)
-
 
905
    oprot.writeMessageEnd()
-
 
906
    oprot.trans.flush()
-
 
907
 
824
 
908
 
825
# HELPER FUNCTIONS AND STRUCTURES
909
# HELPER FUNCTIONS AND STRUCTURES
826
 
910
 
827
class createPayment_args:
911
class createPayment_args:
828
  """
912
  """
Line 2676... Line 2760...
2676
    if self.success is not None:
2760
    if self.success is not None:
2677
      oprot.writeFieldBegin('success', TType.BOOL, 0)
2761
      oprot.writeFieldBegin('success', TType.BOOL, 0)
2678
      oprot.writeBool(self.success)
2762
      oprot.writeBool(self.success)
2679
      oprot.writeFieldEnd()
2763
      oprot.writeFieldEnd()
2680
    if self.pe is not None:
2764
    if self.pe is not None:
-
 
2765
      oprot.writeFieldBegin('pe', TType.STRUCT, 1)
-
 
2766
      self.pe.write(oprot)
-
 
2767
      oprot.writeFieldEnd()
-
 
2768
    oprot.writeFieldStop()
-
 
2769
    oprot.writeStructEnd()
-
 
2770
 
-
 
2771
  def validate(self):
-
 
2772
    return
-
 
2773
 
-
 
2774
 
-
 
2775
  def __repr__(self):
-
 
2776
    L = ['%s=%r' % (key, value)
-
 
2777
      for key, value in self.__dict__.iteritems()]
-
 
2778
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
2779
 
-
 
2780
  def __eq__(self, other):
-
 
2781
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
2782
 
-
 
2783
  def __ne__(self, other):
-
 
2784
    return not (self == other)
-
 
2785
 
-
 
2786
class partiallyCapturePayment_args:
-
 
2787
  """
-
 
2788
  Attributes:
-
 
2789
   - merchantTxnId
-
 
2790
   - amount
-
 
2791
   - xferBy
-
 
2792
   - xferTxnId
-
 
2793
   - xferDate
-
 
2794
  """
-
 
2795
 
-
 
2796
  thrift_spec = (
-
 
2797
    None, # 0
-
 
2798
    (1, TType.I64, 'merchantTxnId', None, None, ), # 1
-
 
2799
    (2, TType.DOUBLE, 'amount', None, None, ), # 2
-
 
2800
    (3, TType.STRING, 'xferBy', None, None, ), # 3
-
 
2801
    (4, TType.STRING, 'xferTxnId', None, None, ), # 4
-
 
2802
    (5, TType.I64, 'xferDate', None, None, ), # 5
-
 
2803
  )
-
 
2804
 
-
 
2805
  def __init__(self, merchantTxnId=None, amount=None, xferBy=None, xferTxnId=None, xferDate=None,):
-
 
2806
    self.merchantTxnId = merchantTxnId
-
 
2807
    self.amount = amount
-
 
2808
    self.xferBy = xferBy
-
 
2809
    self.xferTxnId = xferTxnId
-
 
2810
    self.xferDate = xferDate
-
 
2811
 
-
 
2812
  def read(self, iprot):
-
 
2813
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
2814
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
2815
      return
-
 
2816
    iprot.readStructBegin()
-
 
2817
    while True:
-
 
2818
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
2819
      if ftype == TType.STOP:
-
 
2820
        break
-
 
2821
      if fid == 1:
-
 
2822
        if ftype == TType.I64:
-
 
2823
          self.merchantTxnId = iprot.readI64();
-
 
2824
        else:
-
 
2825
          iprot.skip(ftype)
-
 
2826
      elif fid == 2:
-
 
2827
        if ftype == TType.DOUBLE:
-
 
2828
          self.amount = iprot.readDouble();
-
 
2829
        else:
-
 
2830
          iprot.skip(ftype)
-
 
2831
      elif fid == 3:
-
 
2832
        if ftype == TType.STRING:
-
 
2833
          self.xferBy = iprot.readString();
-
 
2834
        else:
-
 
2835
          iprot.skip(ftype)
-
 
2836
      elif fid == 4:
-
 
2837
        if ftype == TType.STRING:
-
 
2838
          self.xferTxnId = iprot.readString();
-
 
2839
        else:
-
 
2840
          iprot.skip(ftype)
-
 
2841
      elif fid == 5:
-
 
2842
        if ftype == TType.I64:
-
 
2843
          self.xferDate = iprot.readI64();
-
 
2844
        else:
-
 
2845
          iprot.skip(ftype)
-
 
2846
      else:
-
 
2847
        iprot.skip(ftype)
-
 
2848
      iprot.readFieldEnd()
-
 
2849
    iprot.readStructEnd()
-
 
2850
 
-
 
2851
  def write(self, oprot):
-
 
2852
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
2853
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
2854
      return
-
 
2855
    oprot.writeStructBegin('partiallyCapturePayment_args')
-
 
2856
    if self.merchantTxnId is not None:
-
 
2857
      oprot.writeFieldBegin('merchantTxnId', TType.I64, 1)
-
 
2858
      oprot.writeI64(self.merchantTxnId)
-
 
2859
      oprot.writeFieldEnd()
-
 
2860
    if self.amount is not None:
-
 
2861
      oprot.writeFieldBegin('amount', TType.DOUBLE, 2)
-
 
2862
      oprot.writeDouble(self.amount)
-
 
2863
      oprot.writeFieldEnd()
-
 
2864
    if self.xferBy is not None:
-
 
2865
      oprot.writeFieldBegin('xferBy', TType.STRING, 3)
-
 
2866
      oprot.writeString(self.xferBy)
-
 
2867
      oprot.writeFieldEnd()
-
 
2868
    if self.xferTxnId is not None:
-
 
2869
      oprot.writeFieldBegin('xferTxnId', TType.STRING, 4)
-
 
2870
      oprot.writeString(self.xferTxnId)
-
 
2871
      oprot.writeFieldEnd()
-
 
2872
    if self.xferDate is not None:
-
 
2873
      oprot.writeFieldBegin('xferDate', TType.I64, 5)
-
 
2874
      oprot.writeI64(self.xferDate)
-
 
2875
      oprot.writeFieldEnd()
-
 
2876
    oprot.writeFieldStop()
-
 
2877
    oprot.writeStructEnd()
-
 
2878
 
-
 
2879
  def validate(self):
-
 
2880
    return
-
 
2881
 
-
 
2882
 
-
 
2883
  def __repr__(self):
-
 
2884
    L = ['%s=%r' % (key, value)
-
 
2885
      for key, value in self.__dict__.iteritems()]
-
 
2886
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
2887
 
-
 
2888
  def __eq__(self, other):
-
 
2889
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
2890
 
-
 
2891
  def __ne__(self, other):
-
 
2892
    return not (self == other)
-
 
2893
 
-
 
2894
class partiallyCapturePayment_result:
-
 
2895
  """
-
 
2896
  Attributes:
-
 
2897
   - success
-
 
2898
   - pe
-
 
2899
  """
-
 
2900
 
-
 
2901
  thrift_spec = (
-
 
2902
    (0, TType.BOOL, 'success', None, None, ), # 0
-
 
2903
    (1, TType.STRUCT, 'pe', (PaymentException, PaymentException.thrift_spec), None, ), # 1
-
 
2904
  )
-
 
2905
 
-
 
2906
  def __init__(self, success=None, pe=None,):
-
 
2907
    self.success = success
-
 
2908
    self.pe = pe
-
 
2909
 
-
 
2910
  def read(self, iprot):
-
 
2911
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
2912
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
2913
      return
-
 
2914
    iprot.readStructBegin()
-
 
2915
    while True:
-
 
2916
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
2917
      if ftype == TType.STOP:
-
 
2918
        break
-
 
2919
      if fid == 0:
-
 
2920
        if ftype == TType.BOOL:
-
 
2921
          self.success = iprot.readBool();
-
 
2922
        else:
-
 
2923
          iprot.skip(ftype)
-
 
2924
      elif fid == 1:
-
 
2925
        if ftype == TType.STRUCT:
-
 
2926
          self.pe = PaymentException()
-
 
2927
          self.pe.read(iprot)
-
 
2928
        else:
-
 
2929
          iprot.skip(ftype)
-
 
2930
      else:
-
 
2931
        iprot.skip(ftype)
-
 
2932
      iprot.readFieldEnd()
-
 
2933
    iprot.readStructEnd()
-
 
2934
 
-
 
2935
  def write(self, oprot):
-
 
2936
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
2937
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
2938
      return
-
 
2939
    oprot.writeStructBegin('partiallyCapturePayment_result')
-
 
2940
    if self.success is not None:
-
 
2941
      oprot.writeFieldBegin('success', TType.BOOL, 0)
-
 
2942
      oprot.writeBool(self.success)
-
 
2943
      oprot.writeFieldEnd()
-
 
2944
    if self.pe is not None:
2681
      oprot.writeFieldBegin('pe', TType.STRUCT, 1)
2945
      oprot.writeFieldBegin('pe', TType.STRUCT, 1)
2682
      self.pe.write(oprot)
2946
      self.pe.write(oprot)
2683
      oprot.writeFieldEnd()
2947
      oprot.writeFieldEnd()
2684
    oprot.writeFieldStop()
2948
    oprot.writeFieldStop()
2685
    oprot.writeStructEnd()
2949
    oprot.writeStructEnd()