Permalink
Browse files

cancel2-handler

  • Loading branch information...
1 parent 7ab6d31 commit 641f01c4d0112876e7e93b8a71734bab6b74e833 @alexbrasetvik alexbrasetvik committed Apr 16, 2012
Showing with 23 additions and 1 deletion.
  1. +21 −0 payex/pxorder.py
  2. +2 −1 payex/service.py
View
@@ -119,3 +119,24 @@ def __call__(self, *args, **kwargs):
self._endpoint = self._client.service.GetTransactionDetails2
return self._send_request()
+
+
+class PxCancel2Handler(PxOrderHandler):
+ """
+ Reference:
+ http://www.payexpim.com/technical-reference/pxorder/cancel2/
+ """
+
+ field_order = [
+ 'accountNumber',
+ 'transactionNumber'
+ ]
+
+ def __call__(self, *args, **kwargs):
+
+ super(PxCancel2Handler, self).__call__(*args, **kwargs)
+
+ # Set endpoint and send request
+ self._endpoint = self._client.service.Cancel2
+
+ return self._send_request()
View
@@ -1,5 +1,5 @@
from payex.pxagreement import PxCreateAgreement3Handler, PxAutoPay2Handler, PxDeleteAgreementHandler, PxAgreementCheckHandler
-from payex.pxorder import PxOrderInitialize7Handler, PxOrderCompleteHandler, PxOrderCapture4Handler, PxOrderGetTransactionDetails2Handler
+from payex.pxorder import PxOrderInitialize7Handler, PxOrderCompleteHandler, PxOrderCapture4Handler, PxOrderGetTransactionDetails2Handler, PxCancel2Handler
class PayEx(object):
@@ -25,6 +25,7 @@ def __init__(self, merchant_number, encryption_key, production=False):
self.add_resource('complete', PxOrderCompleteHandler)
self.add_resource('capture', PxOrderCapture4Handler)
self.add_resource('get_transaction_details', PxOrderGetTransactionDetails2Handler)
+ self.add_resource('cancel2', PxCancel2Handler)
def add_resource(self, name, handler):
"""

0 comments on commit 641f01c

Please sign in to comment.