Subversion Repositories SmartDukaan

Rev

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

Rev 6228 Rev 6486
Line 186... Line 186...
186
    pass
186
    pass
187
 
187
 
188
  def capturePayment(self, merchantTxnId):
188
  def capturePayment(self, merchantTxnId):
189
    """
189
    """
190
    Capture the payment for the given merchant transaction id. It processes the last payment for the given
190
    Capture the payment for the given merchant transaction id. It processes the last payment for the given
191
    transaction. If the capture attempt failed, the payment is marked as failed. PaymentException with error
-
 
192
    code 104 is	thrown in case no payments are found for the transaction id passed.
191
    transaction. PaymentException with error code 104 is thrown in case no payments are found for the transaction id passed.
193
    PaymentException is also thrown with error code 106 in case capture was not possible due to connection
192
    PaymentException is also thrown with error code 106 in case capture was not possible due to connection
194
    issue. Here, we	payment also gets updated to CAPTURE_INPROCESS state
193
    issue. Here, we	payment also gets updated to CAPTURE_INPROCESS state
195
 
194
 
196
    Parameters:
195
    Parameters:
197
     - merchantTxnId
196
     - merchantTxnId
198
    """
197
    """
199
    pass
198
    pass
200
 
199
 
-
 
200
  def refundPayment(self, merchantTxnId, amount, isDigital):
-
 
201
    """
-
 
202
    Capture the payment for the given merchant transaction id. It processes the last payment for the given
-
 
203
    transaction. If the capture attempt failed, the payment is marked as failed. PaymentException with error
-
 
204
    code 104 is	thrown in case no payments are found for the transaction id passed. PaymentException is also
-
 
205
    thrown with error code 106 in case capture was not possible due to connection
-
 
206
    issue.
-
 
207
 
-
 
208
    Parameters:
-
 
209
     - merchantTxnId
-
 
210
     - amount
-
 
211
     - isDigital
-
 
212
    """
-
 
213
    pass
-
 
214
 
201
  def partiallyCapturePayment(self, merchantTxnId, amount, xferBy, xferTxnId, xferDate):
215
  def partiallyCapturePayment(self, merchantTxnId, amount, xferBy, xferTxnId, xferDate):
202
    """
216
    """
203
    Adds the given amount to the captured amount of a COD payment.
217
    Adds the given amount to the captured amount of a COD payment.
204
    Updates the captured amount for the corresponding payment and marks it as PARTIALLY CAPTURED.
218
    Updates the captured amount for the corresponding payment and marks it as PARTIALLY CAPTURED.
205
    If the captured amount becomes equal to total amount, then the payment status is set as SUCCESS.
219
    If the captured amount becomes equal to total amount, then the payment status is set as SUCCESS.
Line 814... Line 828...
814
    raise TApplicationException(TApplicationException.MISSING_RESULT, "createRefund failed: unknown result");
828
    raise TApplicationException(TApplicationException.MISSING_RESULT, "createRefund failed: unknown result");
815
 
829
 
816
  def capturePayment(self, merchantTxnId):
830
  def capturePayment(self, merchantTxnId):
817
    """
831
    """
818
    Capture the payment for the given merchant transaction id. It processes the last payment for the given
832
    Capture the payment for the given merchant transaction id. It processes the last payment for the given
819
    transaction. If the capture attempt failed, the payment is marked as failed. PaymentException with error
-
 
820
    code 104 is	thrown in case no payments are found for the transaction id passed.
833
    transaction. PaymentException with error code 104 is thrown in case no payments are found for the transaction id passed.
821
    PaymentException is also thrown with error code 106 in case capture was not possible due to connection
834
    PaymentException is also thrown with error code 106 in case capture was not possible due to connection
822
    issue. Here, we	payment also gets updated to CAPTURE_INPROCESS state
835
    issue. Here, we	payment also gets updated to CAPTURE_INPROCESS state
823
 
836
 
824
    Parameters:
837
    Parameters:
825
     - merchantTxnId
838
     - merchantTxnId
Line 849... Line 862...
849
      return result.success
862
      return result.success
850
    if result.pe is not None:
863
    if result.pe is not None:
851
      raise result.pe
864
      raise result.pe
852
    raise TApplicationException(TApplicationException.MISSING_RESULT, "capturePayment failed: unknown result");
865
    raise TApplicationException(TApplicationException.MISSING_RESULT, "capturePayment failed: unknown result");
853
 
866
 
-
 
867
  def refundPayment(self, merchantTxnId, amount, isDigital):
-
 
868
    """
-
 
869
    Capture the payment for the given merchant transaction id. It processes the last payment for the given
-
 
870
    transaction. If the capture attempt failed, the payment is marked as failed. PaymentException with error
-
 
871
    code 104 is	thrown in case no payments are found for the transaction id passed. PaymentException is also
-
 
872
    thrown with error code 106 in case capture was not possible due to connection
-
 
873
    issue.
-
 
874
 
-
 
875
    Parameters:
-
 
876
     - merchantTxnId
-
 
877
     - amount
-
 
878
     - isDigital
-
 
879
    """
-
 
880
    self.send_refundPayment(merchantTxnId, amount, isDigital)
-
 
881
    return self.recv_refundPayment()
-
 
882
 
-
 
883
  def send_refundPayment(self, merchantTxnId, amount, isDigital):
-
 
884
    self._oprot.writeMessageBegin('refundPayment', TMessageType.CALL, self._seqid)
-
 
885
    args = refundPayment_args()
-
 
886
    args.merchantTxnId = merchantTxnId
-
 
887
    args.amount = amount
-
 
888
    args.isDigital = isDigital
-
 
889
    args.write(self._oprot)
-
 
890
    self._oprot.writeMessageEnd()
-
 
891
    self._oprot.trans.flush()
-
 
892
 
-
 
893
  def recv_refundPayment(self, ):
-
 
894
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
895
    if mtype == TMessageType.EXCEPTION:
-
 
896
      x = TApplicationException()
-
 
897
      x.read(self._iprot)
-
 
898
      self._iprot.readMessageEnd()
-
 
899
      raise x
-
 
900
    result = refundPayment_result()
-
 
901
    result.read(self._iprot)
-
 
902
    self._iprot.readMessageEnd()
-
 
903
    if result.success is not None:
-
 
904
      return result.success
-
 
905
    if result.pe is not None:
-
 
906
      raise result.pe
-
 
907
    raise TApplicationException(TApplicationException.MISSING_RESULT, "refundPayment failed: unknown result");
-
 
908
 
854
  def partiallyCapturePayment(self, merchantTxnId, amount, xferBy, xferTxnId, xferDate):
909
  def partiallyCapturePayment(self, merchantTxnId, amount, xferBy, xferTxnId, xferDate):
855
    """
910
    """
856
    Adds the given amount to the captured amount of a COD payment.
911
    Adds the given amount to the captured amount of a COD payment.
857
    Updates the captured amount for the corresponding payment and marks it as PARTIALLY CAPTURED.
912
    Updates the captured amount for the corresponding payment and marks it as PARTIALLY CAPTURED.
858
    If the captured amount becomes equal to total amount, then the payment status is set as SUCCESS.
913
    If the captured amount becomes equal to total amount, then the payment status is set as SUCCESS.
Line 986... Line 1041...
986
    self._processMap["initializeHdfcPayment"] = Processor.process_initializeHdfcPayment
1041
    self._processMap["initializeHdfcPayment"] = Processor.process_initializeHdfcPayment
987
    self._processMap["doHdfcPaymentForDigitalOrder"] = Processor.process_doHdfcPaymentForDigitalOrder
1042
    self._processMap["doHdfcPaymentForDigitalOrder"] = Processor.process_doHdfcPaymentForDigitalOrder
988
    self._processMap["initializeHdfcEmiPayment"] = Processor.process_initializeHdfcEmiPayment
1043
    self._processMap["initializeHdfcEmiPayment"] = Processor.process_initializeHdfcEmiPayment
989
    self._processMap["createRefund"] = Processor.process_createRefund
1044
    self._processMap["createRefund"] = Processor.process_createRefund
990
    self._processMap["capturePayment"] = Processor.process_capturePayment
1045
    self._processMap["capturePayment"] = Processor.process_capturePayment
-
 
1046
    self._processMap["refundPayment"] = Processor.process_refundPayment
991
    self._processMap["partiallyCapturePayment"] = Processor.process_partiallyCapturePayment
1047
    self._processMap["partiallyCapturePayment"] = Processor.process_partiallyCapturePayment
992
    self._processMap["getPaymentsRequiringExtraProcessing"] = Processor.process_getPaymentsRequiringExtraProcessing
1048
    self._processMap["getPaymentsRequiringExtraProcessing"] = Processor.process_getPaymentsRequiringExtraProcessing
993
    self._processMap["markPaymentAsProcessed"] = Processor.process_markPaymentAsProcessed
1049
    self._processMap["markPaymentAsProcessed"] = Processor.process_markPaymentAsProcessed
994
 
1050
 
995
  def process(self, iprot, oprot):
1051
  def process(self, iprot, oprot):
Line 1226... Line 1282...
1226
    oprot.writeMessageBegin("capturePayment", TMessageType.REPLY, seqid)
1282
    oprot.writeMessageBegin("capturePayment", TMessageType.REPLY, seqid)
1227
    result.write(oprot)
1283
    result.write(oprot)
1228
    oprot.writeMessageEnd()
1284
    oprot.writeMessageEnd()
1229
    oprot.trans.flush()
1285
    oprot.trans.flush()
1230
 
1286
 
-
 
1287
  def process_refundPayment(self, seqid, iprot, oprot):
-
 
1288
    args = refundPayment_args()
-
 
1289
    args.read(iprot)
-
 
1290
    iprot.readMessageEnd()
-
 
1291
    result = refundPayment_result()
-
 
1292
    try:
-
 
1293
      result.success = self._handler.refundPayment(args.merchantTxnId, args.amount, args.isDigital)
-
 
1294
    except PaymentException, pe:
-
 
1295
      result.pe = pe
-
 
1296
    oprot.writeMessageBegin("refundPayment", TMessageType.REPLY, seqid)
-
 
1297
    result.write(oprot)
-
 
1298
    oprot.writeMessageEnd()
-
 
1299
    oprot.trans.flush()
-
 
1300
 
1231
  def process_partiallyCapturePayment(self, seqid, iprot, oprot):
1301
  def process_partiallyCapturePayment(self, seqid, iprot, oprot):
1232
    args = partiallyCapturePayment_args()
1302
    args = partiallyCapturePayment_args()
1233
    args.read(iprot)
1303
    args.read(iprot)
1234
    iprot.readMessageEnd()
1304
    iprot.readMessageEnd()
1235
    result = partiallyCapturePayment_result()
1305
    result = partiallyCapturePayment_result()
Line 3702... Line 3772...
3702
    if self.success is not None:
3772
    if self.success is not None:
3703
      oprot.writeFieldBegin('success', TType.BOOL, 0)
3773
      oprot.writeFieldBegin('success', TType.BOOL, 0)
3704
      oprot.writeBool(self.success)
3774
      oprot.writeBool(self.success)
3705
      oprot.writeFieldEnd()
3775
      oprot.writeFieldEnd()
3706
    if self.pe is not None:
3776
    if self.pe is not None:
-
 
3777
      oprot.writeFieldBegin('pe', TType.STRUCT, 1)
-
 
3778
      self.pe.write(oprot)
-
 
3779
      oprot.writeFieldEnd()
-
 
3780
    oprot.writeFieldStop()
-
 
3781
    oprot.writeStructEnd()
-
 
3782
 
-
 
3783
  def validate(self):
-
 
3784
    return
-
 
3785
 
-
 
3786
 
-
 
3787
  def __repr__(self):
-
 
3788
    L = ['%s=%r' % (key, value)
-
 
3789
      for key, value in self.__dict__.iteritems()]
-
 
3790
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
3791
 
-
 
3792
  def __eq__(self, other):
-
 
3793
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
3794
 
-
 
3795
  def __ne__(self, other):
-
 
3796
    return not (self == other)
-
 
3797
 
-
 
3798
class refundPayment_args:
-
 
3799
  """
-
 
3800
  Attributes:
-
 
3801
   - merchantTxnId
-
 
3802
   - amount
-
 
3803
   - isDigital
-
 
3804
  """
-
 
3805
 
-
 
3806
  thrift_spec = (
-
 
3807
    None, # 0
-
 
3808
    (1, TType.I64, 'merchantTxnId', None, None, ), # 1
-
 
3809
    (2, TType.DOUBLE, 'amount', None, None, ), # 2
-
 
3810
    (3, TType.BOOL, 'isDigital', None, None, ), # 3
-
 
3811
  )
-
 
3812
 
-
 
3813
  def __init__(self, merchantTxnId=None, amount=None, isDigital=None,):
-
 
3814
    self.merchantTxnId = merchantTxnId
-
 
3815
    self.amount = amount
-
 
3816
    self.isDigital = isDigital
-
 
3817
 
-
 
3818
  def read(self, iprot):
-
 
3819
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
3820
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
3821
      return
-
 
3822
    iprot.readStructBegin()
-
 
3823
    while True:
-
 
3824
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
3825
      if ftype == TType.STOP:
-
 
3826
        break
-
 
3827
      if fid == 1:
-
 
3828
        if ftype == TType.I64:
-
 
3829
          self.merchantTxnId = iprot.readI64();
-
 
3830
        else:
-
 
3831
          iprot.skip(ftype)
-
 
3832
      elif fid == 2:
-
 
3833
        if ftype == TType.DOUBLE:
-
 
3834
          self.amount = iprot.readDouble();
-
 
3835
        else:
-
 
3836
          iprot.skip(ftype)
-
 
3837
      elif fid == 3:
-
 
3838
        if ftype == TType.BOOL:
-
 
3839
          self.isDigital = iprot.readBool();
-
 
3840
        else:
-
 
3841
          iprot.skip(ftype)
-
 
3842
      else:
-
 
3843
        iprot.skip(ftype)
-
 
3844
      iprot.readFieldEnd()
-
 
3845
    iprot.readStructEnd()
-
 
3846
 
-
 
3847
  def write(self, oprot):
-
 
3848
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
3849
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
3850
      return
-
 
3851
    oprot.writeStructBegin('refundPayment_args')
-
 
3852
    if self.merchantTxnId is not None:
-
 
3853
      oprot.writeFieldBegin('merchantTxnId', TType.I64, 1)
-
 
3854
      oprot.writeI64(self.merchantTxnId)
-
 
3855
      oprot.writeFieldEnd()
-
 
3856
    if self.amount is not None:
-
 
3857
      oprot.writeFieldBegin('amount', TType.DOUBLE, 2)
-
 
3858
      oprot.writeDouble(self.amount)
-
 
3859
      oprot.writeFieldEnd()
-
 
3860
    if self.isDigital is not None:
-
 
3861
      oprot.writeFieldBegin('isDigital', TType.BOOL, 3)
-
 
3862
      oprot.writeBool(self.isDigital)
-
 
3863
      oprot.writeFieldEnd()
-
 
3864
    oprot.writeFieldStop()
-
 
3865
    oprot.writeStructEnd()
-
 
3866
 
-
 
3867
  def validate(self):
-
 
3868
    return
-
 
3869
 
-
 
3870
 
-
 
3871
  def __repr__(self):
-
 
3872
    L = ['%s=%r' % (key, value)
-
 
3873
      for key, value in self.__dict__.iteritems()]
-
 
3874
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
3875
 
-
 
3876
  def __eq__(self, other):
-
 
3877
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
3878
 
-
 
3879
  def __ne__(self, other):
-
 
3880
    return not (self == other)
-
 
3881
 
-
 
3882
class refundPayment_result:
-
 
3883
  """
-
 
3884
  Attributes:
-
 
3885
   - success
-
 
3886
   - pe
-
 
3887
  """
-
 
3888
 
-
 
3889
  thrift_spec = (
-
 
3890
    (0, TType.BOOL, 'success', None, None, ), # 0
-
 
3891
    (1, TType.STRUCT, 'pe', (PaymentException, PaymentException.thrift_spec), None, ), # 1
-
 
3892
  )
-
 
3893
 
-
 
3894
  def __init__(self, success=None, pe=None,):
-
 
3895
    self.success = success
-
 
3896
    self.pe = pe
-
 
3897
 
-
 
3898
  def read(self, iprot):
-
 
3899
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
3900
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
3901
      return
-
 
3902
    iprot.readStructBegin()
-
 
3903
    while True:
-
 
3904
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
3905
      if ftype == TType.STOP:
-
 
3906
        break
-
 
3907
      if fid == 0:
-
 
3908
        if ftype == TType.BOOL:
-
 
3909
          self.success = iprot.readBool();
-
 
3910
        else:
-
 
3911
          iprot.skip(ftype)
-
 
3912
      elif fid == 1:
-
 
3913
        if ftype == TType.STRUCT:
-
 
3914
          self.pe = PaymentException()
-
 
3915
          self.pe.read(iprot)
-
 
3916
        else:
-
 
3917
          iprot.skip(ftype)
-
 
3918
      else:
-
 
3919
        iprot.skip(ftype)
-
 
3920
      iprot.readFieldEnd()
-
 
3921
    iprot.readStructEnd()
-
 
3922
 
-
 
3923
  def write(self, oprot):
-
 
3924
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
3925
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
3926
      return
-
 
3927
    oprot.writeStructBegin('refundPayment_result')
-
 
3928
    if self.success is not None:
-
 
3929
      oprot.writeFieldBegin('success', TType.BOOL, 0)
-
 
3930
      oprot.writeBool(self.success)
-
 
3931
      oprot.writeFieldEnd()
-
 
3932
    if self.pe is not None:
3707
      oprot.writeFieldBegin('pe', TType.STRUCT, 1)
3933
      oprot.writeFieldBegin('pe', TType.STRUCT, 1)
3708
      self.pe.write(oprot)
3934
      self.pe.write(oprot)
3709
      oprot.writeFieldEnd()
3935
      oprot.writeFieldEnd()
3710
    oprot.writeFieldStop()
3936
    oprot.writeFieldStop()
3711
    oprot.writeStructEnd()
3937
    oprot.writeStructEnd()