Subversion Repositories SmartDukaan

Rev

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

Rev 2559 Rev 2685
Line 147... Line 147...
147
    Parameters:
147
    Parameters:
148
     - merchantPaymentId
148
     - merchantPaymentId
149
    """
149
    """
150
    pass
150
    pass
151
 
151
 
-
 
152
  def createRefund(self, orderId, merchantTxnId, amount):
-
 
153
    """
-
 
154
    Create a refund of the given amount corresponding to the given order to be processed through the same
-
 
155
    payment gateway which processed the payment for the corresponding transaction.
-
 
156
    
-
 
157
    Parameters:
-
 
158
     - orderId
-
 
159
     - merchantTxnId
-
 
160
     - amount
-
 
161
    """
-
 
162
    pass
-
 
163
 
152
 
164
 
153
class Client(Iface):
165
class Client(Iface):
154
  def __init__(self, iprot, oprot=None):
166
  def __init__(self, iprot, oprot=None):
155
    self._iprot = self._oprot = iprot
167
    self._iprot = self._oprot = iprot
156
    if oprot != None:
168
    if oprot != None:
Line 601... Line 613...
601
      return result.success
613
      return result.success
602
    if result.pe != None:
614
    if result.pe != None:
603
      raise result.pe
615
      raise result.pe
604
    raise TApplicationException(TApplicationException.MISSING_RESULT, "initializeHdfcPayment failed: unknown result");
616
    raise TApplicationException(TApplicationException.MISSING_RESULT, "initializeHdfcPayment failed: unknown result");
605
 
617
 
-
 
618
  def createRefund(self, orderId, merchantTxnId, amount):
-
 
619
    """
-
 
620
    Create a refund of the given amount corresponding to the given order to be processed through the same
-
 
621
    payment gateway which processed the payment for the corresponding transaction.
-
 
622
    
-
 
623
    Parameters:
-
 
624
     - orderId
-
 
625
     - merchantTxnId
-
 
626
     - amount
-
 
627
    """
-
 
628
    self.send_createRefund(orderId, merchantTxnId, amount)
-
 
629
    return self.recv_createRefund()
-
 
630
 
-
 
631
  def send_createRefund(self, orderId, merchantTxnId, amount):
-
 
632
    self._oprot.writeMessageBegin('createRefund', TMessageType.CALL, self._seqid)
-
 
633
    args = createRefund_args()
-
 
634
    args.orderId = orderId
-
 
635
    args.merchantTxnId = merchantTxnId
-
 
636
    args.amount = amount
-
 
637
    args.write(self._oprot)
-
 
638
    self._oprot.writeMessageEnd()
-
 
639
    self._oprot.trans.flush()
-
 
640
 
-
 
641
  def recv_createRefund(self, ):
-
 
642
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
643
    if mtype == TMessageType.EXCEPTION:
-
 
644
      x = TApplicationException()
-
 
645
      x.read(self._iprot)
-
 
646
      self._iprot.readMessageEnd()
-
 
647
      raise x
-
 
648
    result = createRefund_result()
-
 
649
    result.read(self._iprot)
-
 
650
    self._iprot.readMessageEnd()
-
 
651
    if result.success != None:
-
 
652
      return result.success
-
 
653
    if result.pe != None:
-
 
654
      raise result.pe
-
 
655
    raise TApplicationException(TApplicationException.MISSING_RESULT, "createRefund failed: unknown result");
-
 
656
 
606
 
657
 
607
class Processor(Iface, TProcessor):
658
class Processor(Iface, TProcessor):
608
  def __init__(self, handler):
659
  def __init__(self, handler):
609
    self._handler = handler
660
    self._handler = handler
610
    self._processMap = {}
661
    self._processMap = {}
Line 618... Line 669...
618
    self._processMap["updatePaymentDetails"] = Processor.process_updatePaymentDetails
669
    self._processMap["updatePaymentDetails"] = Processor.process_updatePaymentDetails
619
    self._processMap["getSuccessfulPaymentsAmountRange"] = Processor.process_getSuccessfulPaymentsAmountRange
670
    self._processMap["getSuccessfulPaymentsAmountRange"] = Processor.process_getSuccessfulPaymentsAmountRange
620
    self._processMap["updateAndCaptureEbsPayment"] = Processor.process_updateAndCaptureEbsPayment
671
    self._processMap["updateAndCaptureEbsPayment"] = Processor.process_updateAndCaptureEbsPayment
621
    self._processMap["captureHdfcPayment"] = Processor.process_captureHdfcPayment
672
    self._processMap["captureHdfcPayment"] = Processor.process_captureHdfcPayment
622
    self._processMap["initializeHdfcPayment"] = Processor.process_initializeHdfcPayment
673
    self._processMap["initializeHdfcPayment"] = Processor.process_initializeHdfcPayment
-
 
674
    self._processMap["createRefund"] = Processor.process_createRefund
623
 
675
 
624
  def process(self, iprot, oprot):
676
  def process(self, iprot, oprot):
625
    (name, type, seqid) = iprot.readMessageBegin()
677
    (name, type, seqid) = iprot.readMessageBegin()
626
    if name not in self._processMap:
678
    if name not in self._processMap:
627
      iprot.skip(TType.STRUCT)
679
      iprot.skip(TType.STRUCT)
Line 796... Line 848...
796
    oprot.writeMessageBegin("initializeHdfcPayment", TMessageType.REPLY, seqid)
848
    oprot.writeMessageBegin("initializeHdfcPayment", TMessageType.REPLY, seqid)
797
    result.write(oprot)
849
    result.write(oprot)
798
    oprot.writeMessageEnd()
850
    oprot.writeMessageEnd()
799
    oprot.trans.flush()
851
    oprot.trans.flush()
800
 
852
 
-
 
853
  def process_createRefund(self, seqid, iprot, oprot):
-
 
854
    args = createRefund_args()
-
 
855
    args.read(iprot)
-
 
856
    iprot.readMessageEnd()
-
 
857
    result = createRefund_result()
-
 
858
    try:
-
 
859
      result.success = self._handler.createRefund(args.orderId, args.merchantTxnId, args.amount)
-
 
860
    except PaymentException, pe:
-
 
861
      result.pe = pe
-
 
862
    oprot.writeMessageBegin("createRefund", TMessageType.REPLY, seqid)
-
 
863
    result.write(oprot)
-
 
864
    oprot.writeMessageEnd()
-
 
865
    oprot.trans.flush()
-
 
866
 
801
 
867
 
802
# HELPER FUNCTIONS AND STRUCTURES
868
# HELPER FUNCTIONS AND STRUCTURES
803
 
869
 
804
class closeSession_args:
870
class closeSession_args:
805
 
871
 
Line 2513... Line 2579...
2513
      oprot.writeFieldEnd()
2579
      oprot.writeFieldEnd()
2514
    if self.pe != None:
2580
    if self.pe != None:
2515
      oprot.writeFieldBegin('pe', TType.STRUCT, 1)
2581
      oprot.writeFieldBegin('pe', TType.STRUCT, 1)
2516
      self.pe.write(oprot)
2582
      self.pe.write(oprot)
2517
      oprot.writeFieldEnd()
2583
      oprot.writeFieldEnd()
-
 
2584
    oprot.writeFieldStop()
-
 
2585
    oprot.writeStructEnd()
-
 
2586
 
-
 
2587
  def __repr__(self):
-
 
2588
    L = ['%s=%r' % (key, value)
-
 
2589
      for key, value in self.__dict__.iteritems()]
-
 
2590
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
2591
 
-
 
2592
  def __eq__(self, other):
-
 
2593
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
2594
 
-
 
2595
  def __ne__(self, other):
-
 
2596
    return not (self == other)
-
 
2597
 
-
 
2598
class createRefund_args:
-
 
2599
  """
-
 
2600
  Attributes:
-
 
2601
   - orderId
-
 
2602
   - merchantTxnId
-
 
2603
   - amount
-
 
2604
  """
-
 
2605
 
-
 
2606
  thrift_spec = (
-
 
2607
    None, # 0
-
 
2608
    (1, TType.I64, 'orderId', None, None, ), # 1
-
 
2609
    (2, TType.I64, 'merchantTxnId', None, None, ), # 2
-
 
2610
    (3, TType.DOUBLE, 'amount', None, None, ), # 3
-
 
2611
  )
-
 
2612
 
-
 
2613
  def __init__(self, orderId=None, merchantTxnId=None, amount=None,):
-
 
2614
    self.orderId = orderId
-
 
2615
    self.merchantTxnId = merchantTxnId
-
 
2616
    self.amount = amount
-
 
2617
 
-
 
2618
  def read(self, iprot):
-
 
2619
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
2620
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
2621
      return
-
 
2622
    iprot.readStructBegin()
-
 
2623
    while True:
-
 
2624
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
2625
      if ftype == TType.STOP:
-
 
2626
        break
-
 
2627
      if fid == 1:
-
 
2628
        if ftype == TType.I64:
-
 
2629
          self.orderId = iprot.readI64();
-
 
2630
        else:
-
 
2631
          iprot.skip(ftype)
-
 
2632
      elif fid == 2:
-
 
2633
        if ftype == TType.I64:
-
 
2634
          self.merchantTxnId = iprot.readI64();
-
 
2635
        else:
-
 
2636
          iprot.skip(ftype)
-
 
2637
      elif fid == 3:
-
 
2638
        if ftype == TType.DOUBLE:
-
 
2639
          self.amount = iprot.readDouble();
-
 
2640
        else:
-
 
2641
          iprot.skip(ftype)
-
 
2642
      else:
-
 
2643
        iprot.skip(ftype)
-
 
2644
      iprot.readFieldEnd()
-
 
2645
    iprot.readStructEnd()
-
 
2646
 
-
 
2647
  def write(self, oprot):
-
 
2648
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
2649
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
2650
      return
-
 
2651
    oprot.writeStructBegin('createRefund_args')
-
 
2652
    if self.orderId != None:
-
 
2653
      oprot.writeFieldBegin('orderId', TType.I64, 1)
-
 
2654
      oprot.writeI64(self.orderId)
-
 
2655
      oprot.writeFieldEnd()
-
 
2656
    if self.merchantTxnId != None:
-
 
2657
      oprot.writeFieldBegin('merchantTxnId', TType.I64, 2)
-
 
2658
      oprot.writeI64(self.merchantTxnId)
-
 
2659
      oprot.writeFieldEnd()
-
 
2660
    if self.amount != None:
-
 
2661
      oprot.writeFieldBegin('amount', TType.DOUBLE, 3)
-
 
2662
      oprot.writeDouble(self.amount)
-
 
2663
      oprot.writeFieldEnd()
-
 
2664
    oprot.writeFieldStop()
-
 
2665
    oprot.writeStructEnd()
-
 
2666
 
-
 
2667
  def __repr__(self):
-
 
2668
    L = ['%s=%r' % (key, value)
-
 
2669
      for key, value in self.__dict__.iteritems()]
-
 
2670
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
2671
 
-
 
2672
  def __eq__(self, other):
-
 
2673
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
2674
 
-
 
2675
  def __ne__(self, other):
-
 
2676
    return not (self == other)
-
 
2677
 
-
 
2678
class createRefund_result:
-
 
2679
  """
-
 
2680
  Attributes:
-
 
2681
   - success
-
 
2682
   - pe
-
 
2683
  """
-
 
2684
 
-
 
2685
  thrift_spec = (
-
 
2686
    (0, TType.I64, 'success', None, None, ), # 0
-
 
2687
    (1, TType.STRUCT, 'pe', (PaymentException, PaymentException.thrift_spec), None, ), # 1
-
 
2688
  )
-
 
2689
 
-
 
2690
  def __init__(self, success=None, pe=None,):
-
 
2691
    self.success = success
-
 
2692
    self.pe = pe
-
 
2693
 
-
 
2694
  def read(self, iprot):
-
 
2695
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
2696
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
2697
      return
-
 
2698
    iprot.readStructBegin()
-
 
2699
    while True:
-
 
2700
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
2701
      if ftype == TType.STOP:
-
 
2702
        break
-
 
2703
      if fid == 0:
-
 
2704
        if ftype == TType.I64:
-
 
2705
          self.success = iprot.readI64();
-
 
2706
        else:
-
 
2707
          iprot.skip(ftype)
-
 
2708
      elif fid == 1:
-
 
2709
        if ftype == TType.STRUCT:
-
 
2710
          self.pe = PaymentException()
-
 
2711
          self.pe.read(iprot)
-
 
2712
        else:
-
 
2713
          iprot.skip(ftype)
-
 
2714
      else:
-
 
2715
        iprot.skip(ftype)
-
 
2716
      iprot.readFieldEnd()
-
 
2717
    iprot.readStructEnd()
-
 
2718
 
-
 
2719
  def write(self, oprot):
-
 
2720
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
2721
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
2722
      return
-
 
2723
    oprot.writeStructBegin('createRefund_result')
-
 
2724
    if self.success != None:
-
 
2725
      oprot.writeFieldBegin('success', TType.I64, 0)
-
 
2726
      oprot.writeI64(self.success)
-
 
2727
      oprot.writeFieldEnd()
-
 
2728
    if self.pe != None:
-
 
2729
      oprot.writeFieldBegin('pe', TType.STRUCT, 1)
-
 
2730
      self.pe.write(oprot)
-
 
2731
      oprot.writeFieldEnd()
2518
    oprot.writeFieldStop()
2732
    oprot.writeFieldStop()
2519
    oprot.writeStructEnd()
2733
    oprot.writeStructEnd()
2520
 
2734
 
2521
  def __repr__(self):
2735
  def __repr__(self):
2522
    L = ['%s=%r' % (key, value)
2736
    L = ['%s=%r' % (key, value)