forked from AuthorizeNet/sample-code-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvoid.py
More file actions
39 lines (31 loc) · 1.41 KB
/
void.py
File metadata and controls
39 lines (31 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from authorizenet import apicontractsv1
from authorizenet.apicontrollers import *
from decimal import *
merchantAuth = apicontractsv1.merchantAuthenticationType()
merchantAuth.name = '5KP3u95bQpv'
merchantAuth.transactionKey = '4Ktq966gC55GAX7S'
paypal = apicontractsv1.payPalType()
payment = apicontractsv1.paymentType()
payment.payPal = paypal
transactionrequest = apicontractsv1.transactionRequestType()
transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.voidTransaction
transactionrequest.refTransId = "2245592542"
transactionrequest.payment = payment
request = apicontractsv1.createTransactionRequest()
request.merchantAuthentication = merchantAuth
request.refId = "Sample"
request.transactionRequest = transactionrequest
controller = createTransactionController(request)
controller.execute()
response = controller.getresponse()
if (response.messages.resultCode=="Ok"):
print "SUCCESS"
print "Message Code : %s" % response.messages.message[0].code
print "Message text : %s" % response.messages.message[0].text
if (response.transactionResponse.responseCode == "1" ):
print "Transaction ID : %s " % response.transactionResponse.transId
print "Description : %s " % response.transactionResponse.messages.message[0].description
else:
print "ERROR"
print "Message Code : %s" % response.messages.message[0].code
print "Message text : %s" % response.messages.message[0].text