Subversion Repositories SmartDukaan

Rev

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

Rev 3583 Rev 3616
Line 123... Line 123...
123
    Parameters:
123
    Parameters:
124
     - merchantPaymentId
124
     - merchantPaymentId
125
    """
125
    """
126
    pass
126
    pass
127
 
127
 
-
 
128
  def initializeHdfcEmiPayment(self, merchantPaymentId):
-
 
129
    """
-
 
130
    Initialize the payment pipe for a HDFC EMI payment. The URL the user should be redirected to is returned.
-
 
131
    In case of any processing error, an exception is raised.
-
 
132
 
-
 
133
    Parameters:
-
 
134
     - merchantPaymentId
-
 
135
    """
-
 
136
    pass
-
 
137
 
128
  def createRefund(self, orderId, merchantTxnId, amount):
138
  def createRefund(self, orderId, merchantTxnId, amount):
129
    """
139
    """
130
    Create a refund of the given amount corresponding to the given order to be processed through the same
140
    Create a refund of the given amount corresponding to the given order to be processed through the same
131
    payment gateway which processed the payment for the corresponding transaction.
141
    payment gateway which processed the payment for the corresponding transaction.
132
    Returns the id of the newly created Refund.
142
    Returns the id of the newly created Refund.
Line 502... Line 512...
502
      return result.success
512
      return result.success
503
    if result.pe is not None:
513
    if result.pe is not None:
504
      raise result.pe
514
      raise result.pe
505
    raise TApplicationException(TApplicationException.MISSING_RESULT, "initializeHdfcPayment failed: unknown result");
515
    raise TApplicationException(TApplicationException.MISSING_RESULT, "initializeHdfcPayment failed: unknown result");
506
 
516
 
-
 
517
  def initializeHdfcEmiPayment(self, merchantPaymentId):
-
 
518
    """
-
 
519
    Initialize the payment pipe for a HDFC EMI payment. The URL the user should be redirected to is returned.
-
 
520
    In case of any processing error, an exception is raised.
-
 
521
 
-
 
522
    Parameters:
-
 
523
     - merchantPaymentId
-
 
524
    """
-
 
525
    self.send_initializeHdfcEmiPayment(merchantPaymentId)
-
 
526
    return self.recv_initializeHdfcEmiPayment()
-
 
527
 
-
 
528
  def send_initializeHdfcEmiPayment(self, merchantPaymentId):
-
 
529
    self._oprot.writeMessageBegin('initializeHdfcEmiPayment', TMessageType.CALL, self._seqid)
-
 
530
    args = initializeHdfcEmiPayment_args()
-
 
531
    args.merchantPaymentId = merchantPaymentId
-
 
532
    args.write(self._oprot)
-
 
533
    self._oprot.writeMessageEnd()
-
 
534
    self._oprot.trans.flush()
-
 
535
 
-
 
536
  def recv_initializeHdfcEmiPayment(self, ):
-
 
537
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
538
    if mtype == TMessageType.EXCEPTION:
-
 
539
      x = TApplicationException()
-
 
540
      x.read(self._iprot)
-
 
541
      self._iprot.readMessageEnd()
-
 
542
      raise x
-
 
543
    result = initializeHdfcEmiPayment_result()
-
 
544
    result.read(self._iprot)
-
 
545
    self._iprot.readMessageEnd()
-
 
546
    if result.success is not None:
-
 
547
      return result.success
-
 
548
    if result.pe is not None:
-
 
549
      raise result.pe
-
 
550
    raise TApplicationException(TApplicationException.MISSING_RESULT, "initializeHdfcEmiPayment failed: unknown result");
-
 
551
 
507
  def createRefund(self, orderId, merchantTxnId, amount):
552
  def createRefund(self, orderId, merchantTxnId, amount):
508
    """
553
    """
509
    Create a refund of the given amount corresponding to the given order to be processed through the same
554
    Create a refund of the given amount corresponding to the given order to be processed through the same
510
    payment gateway which processed the payment for the corresponding transaction.
555
    payment gateway which processed the payment for the corresponding transaction.
511
    Returns the id of the newly created Refund.
556
    Returns the id of the newly created Refund.
Line 590... Line 635...
590
    self._processMap["getPayment"] = Processor.process_getPayment
635
    self._processMap["getPayment"] = Processor.process_getPayment
591
    self._processMap["getPaymentForTxnId"] = Processor.process_getPaymentForTxnId
636
    self._processMap["getPaymentForTxnId"] = Processor.process_getPaymentForTxnId
592
    self._processMap["updatePaymentDetails"] = Processor.process_updatePaymentDetails
637
    self._processMap["updatePaymentDetails"] = Processor.process_updatePaymentDetails
593
    self._processMap["getSuccessfulPaymentsAmountRange"] = Processor.process_getSuccessfulPaymentsAmountRange
638
    self._processMap["getSuccessfulPaymentsAmountRange"] = Processor.process_getSuccessfulPaymentsAmountRange
594
    self._processMap["initializeHdfcPayment"] = Processor.process_initializeHdfcPayment
639
    self._processMap["initializeHdfcPayment"] = Processor.process_initializeHdfcPayment
-
 
640
    self._processMap["initializeHdfcEmiPayment"] = Processor.process_initializeHdfcEmiPayment
595
    self._processMap["createRefund"] = Processor.process_createRefund
641
    self._processMap["createRefund"] = Processor.process_createRefund
596
    self._processMap["capturePayment"] = Processor.process_capturePayment
642
    self._processMap["capturePayment"] = Processor.process_capturePayment
597
 
643
 
598
  def process(self, iprot, oprot):
644
  def process(self, iprot, oprot):
599
    (name, type, seqid) = iprot.readMessageBegin()
645
    (name, type, seqid) = iprot.readMessageBegin()
Line 731... Line 777...
731
    oprot.writeMessageBegin("initializeHdfcPayment", TMessageType.REPLY, seqid)
777
    oprot.writeMessageBegin("initializeHdfcPayment", TMessageType.REPLY, seqid)
732
    result.write(oprot)
778
    result.write(oprot)
733
    oprot.writeMessageEnd()
779
    oprot.writeMessageEnd()
734
    oprot.trans.flush()
780
    oprot.trans.flush()
735
 
781
 
-
 
782
  def process_initializeHdfcEmiPayment(self, seqid, iprot, oprot):
-
 
783
    args = initializeHdfcEmiPayment_args()
-
 
784
    args.read(iprot)
-
 
785
    iprot.readMessageEnd()
-
 
786
    result = initializeHdfcEmiPayment_result()
-
 
787
    try:
-
 
788
      result.success = self._handler.initializeHdfcEmiPayment(args.merchantPaymentId)
-
 
789
    except PaymentException, pe:
-
 
790
      result.pe = pe
-
 
791
    oprot.writeMessageBegin("initializeHdfcEmiPayment", TMessageType.REPLY, seqid)
-
 
792
    result.write(oprot)
-
 
793
    oprot.writeMessageEnd()
-
 
794
    oprot.trans.flush()
-
 
795
 
736
  def process_createRefund(self, seqid, iprot, oprot):
796
  def process_createRefund(self, seqid, iprot, oprot):
737
    args = createRefund_args()
797
    args = createRefund_args()
738
    args.read(iprot)
798
    args.read(iprot)
739
    iprot.readMessageEnd()
799
    iprot.readMessageEnd()
740
    result = createRefund_result()
800
    result = createRefund_result()
Line 2196... Line 2256...
2196
    if self.success is not None:
2256
    if self.success is not None:
2197
      oprot.writeFieldBegin('success', TType.STRING, 0)
2257
      oprot.writeFieldBegin('success', TType.STRING, 0)
2198
      oprot.writeString(self.success)
2258
      oprot.writeString(self.success)
2199
      oprot.writeFieldEnd()
2259
      oprot.writeFieldEnd()
2200
    if self.pe is not None:
2260
    if self.pe is not None:
-
 
2261
      oprot.writeFieldBegin('pe', TType.STRUCT, 1)
-
 
2262
      self.pe.write(oprot)
-
 
2263
      oprot.writeFieldEnd()
-
 
2264
    oprot.writeFieldStop()
-
 
2265
    oprot.writeStructEnd()
-
 
2266
 
-
 
2267
  def validate(self):
-
 
2268
    return
-
 
2269
 
-
 
2270
 
-
 
2271
  def __repr__(self):
-
 
2272
    L = ['%s=%r' % (key, value)
-
 
2273
      for key, value in self.__dict__.iteritems()]
-
 
2274
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
2275
 
-
 
2276
  def __eq__(self, other):
-
 
2277
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
2278
 
-
 
2279
  def __ne__(self, other):
-
 
2280
    return not (self == other)
-
 
2281
 
-
 
2282
class initializeHdfcEmiPayment_args:
-
 
2283
  """
-
 
2284
  Attributes:
-
 
2285
   - merchantPaymentId
-
 
2286
  """
-
 
2287
 
-
 
2288
  thrift_spec = (
-
 
2289
    None, # 0
-
 
2290
    (1, TType.I64, 'merchantPaymentId', None, None, ), # 1
-
 
2291
  )
-
 
2292
 
-
 
2293
  def __init__(self, merchantPaymentId=None,):
-
 
2294
    self.merchantPaymentId = merchantPaymentId
-
 
2295
 
-
 
2296
  def read(self, iprot):
-
 
2297
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
2298
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
2299
      return
-
 
2300
    iprot.readStructBegin()
-
 
2301
    while True:
-
 
2302
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
2303
      if ftype == TType.STOP:
-
 
2304
        break
-
 
2305
      if fid == 1:
-
 
2306
        if ftype == TType.I64:
-
 
2307
          self.merchantPaymentId = iprot.readI64();
-
 
2308
        else:
-
 
2309
          iprot.skip(ftype)
-
 
2310
      else:
-
 
2311
        iprot.skip(ftype)
-
 
2312
      iprot.readFieldEnd()
-
 
2313
    iprot.readStructEnd()
-
 
2314
 
-
 
2315
  def write(self, oprot):
-
 
2316
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
2317
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
2318
      return
-
 
2319
    oprot.writeStructBegin('initializeHdfcEmiPayment_args')
-
 
2320
    if self.merchantPaymentId is not None:
-
 
2321
      oprot.writeFieldBegin('merchantPaymentId', TType.I64, 1)
-
 
2322
      oprot.writeI64(self.merchantPaymentId)
-
 
2323
      oprot.writeFieldEnd()
-
 
2324
    oprot.writeFieldStop()
-
 
2325
    oprot.writeStructEnd()
-
 
2326
 
-
 
2327
  def validate(self):
-
 
2328
    return
-
 
2329
 
-
 
2330
 
-
 
2331
  def __repr__(self):
-
 
2332
    L = ['%s=%r' % (key, value)
-
 
2333
      for key, value in self.__dict__.iteritems()]
-
 
2334
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
2335
 
-
 
2336
  def __eq__(self, other):
-
 
2337
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
2338
 
-
 
2339
  def __ne__(self, other):
-
 
2340
    return not (self == other)
-
 
2341
 
-
 
2342
class initializeHdfcEmiPayment_result:
-
 
2343
  """
-
 
2344
  Attributes:
-
 
2345
   - success
-
 
2346
   - pe
-
 
2347
  """
-
 
2348
 
-
 
2349
  thrift_spec = (
-
 
2350
    (0, TType.STRING, 'success', None, None, ), # 0
-
 
2351
    (1, TType.STRUCT, 'pe', (PaymentException, PaymentException.thrift_spec), None, ), # 1
-
 
2352
  )
-
 
2353
 
-
 
2354
  def __init__(self, success=None, pe=None,):
-
 
2355
    self.success = success
-
 
2356
    self.pe = pe
-
 
2357
 
-
 
2358
  def read(self, iprot):
-
 
2359
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
2360
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
2361
      return
-
 
2362
    iprot.readStructBegin()
-
 
2363
    while True:
-
 
2364
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
2365
      if ftype == TType.STOP:
-
 
2366
        break
-
 
2367
      if fid == 0:
-
 
2368
        if ftype == TType.STRING:
-
 
2369
          self.success = iprot.readString();
-
 
2370
        else:
-
 
2371
          iprot.skip(ftype)
-
 
2372
      elif fid == 1:
-
 
2373
        if ftype == TType.STRUCT:
-
 
2374
          self.pe = PaymentException()
-
 
2375
          self.pe.read(iprot)
-
 
2376
        else:
-
 
2377
          iprot.skip(ftype)
-
 
2378
      else:
-
 
2379
        iprot.skip(ftype)
-
 
2380
      iprot.readFieldEnd()
-
 
2381
    iprot.readStructEnd()
-
 
2382
 
-
 
2383
  def write(self, oprot):
-
 
2384
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
2385
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
2386
      return
-
 
2387
    oprot.writeStructBegin('initializeHdfcEmiPayment_result')
-
 
2388
    if self.success is not None:
-
 
2389
      oprot.writeFieldBegin('success', TType.STRING, 0)
-
 
2390
      oprot.writeString(self.success)
-
 
2391
      oprot.writeFieldEnd()
-
 
2392
    if self.pe is not None:
2201
      oprot.writeFieldBegin('pe', TType.STRUCT, 1)
2393
      oprot.writeFieldBegin('pe', TType.STRUCT, 1)
2202
      self.pe.write(oprot)
2394
      self.pe.write(oprot)
2203
      oprot.writeFieldEnd()
2395
      oprot.writeFieldEnd()
2204
    oprot.writeFieldStop()
2396
    oprot.writeFieldStop()
2205
    oprot.writeStructEnd()
2397
    oprot.writeStructEnd()