|
7 | 7 | from decimal import * |
8 | 8 |
|
9 | 9 | def authorization_only_continued(): |
10 | | - merchantAuth = apicontractsv1.merchantAuthenticationType() |
11 | | - merchantAuth.name = constants.apiLoginId |
12 | | - merchantAuth.transactionKey = constants.transactionKey |
| 10 | + merchantAuth = apicontractsv1.merchantAuthenticationType() |
| 11 | + merchantAuth.name = constants.apiLoginId |
| 12 | + merchantAuth.transactionKey = constants.transactionKey |
13 | 13 |
|
14 | | - paypal = apicontractsv1.payPalType() |
15 | | - paypal.successUrl = "http://www.merchanteCommerceSite.com/Success/TC25262" |
16 | | - paypal.cancelUrl = "http://www.merchanteCommerceSite.com/Success/TC25262" |
17 | | - paypal.payerID = "LM6NCLZ5RAKBY" |
| 14 | + paypal = apicontractsv1.payPalType() |
| 15 | + paypal.successUrl = "http://www.merchanteCommerceSite.com/Success/TC25262" |
| 16 | + paypal.cancelUrl = "http://www.merchanteCommerceSite.com/Success/TC25262" |
| 17 | + paypal.payerID = "LM6NCLZ5RAKBY" |
18 | 18 |
|
19 | | - payment = apicontractsv1.paymentType() |
20 | | - payment.payPal = paypal |
| 19 | + payment = apicontractsv1.paymentType() |
| 20 | + payment.payPal = paypal |
21 | 21 |
|
22 | | - transactionrequest = apicontractsv1.transactionRequestType() |
23 | | - transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.authOnlyContinueTransaction |
24 | | - transactionrequest.refTransId = "2245592542" |
25 | | - transactionrequest.payment = payment |
| 22 | + transactionrequest = apicontractsv1.transactionRequestType() |
| 23 | + transactionrequest.transactionType = apicontractsv1.transactionTypeEnum.authOnlyContinueTransaction |
| 24 | + transactionrequest.refTransId = "2245592542" |
| 25 | + transactionrequest.payment = payment |
26 | 26 |
|
27 | | - request = apicontractsv1.createTransactionRequest() |
28 | | - request.merchantAuthentication = merchantAuth |
29 | | - request.refId = "Sample" |
30 | | - request.transactionRequest = transactionrequest |
| 27 | + request = apicontractsv1.createTransactionRequest() |
| 28 | + request.merchantAuthentication = merchantAuth |
| 29 | + request.refId = "Sample" |
| 30 | + request.transactionRequest = transactionrequest |
31 | 31 |
|
32 | | - controller = createTransactionController(request) |
33 | | - controller.execute() |
| 32 | + controller = createTransactionController(request) |
| 33 | + controller.execute() |
34 | 34 |
|
35 | | - response = controller.getresponse() |
| 35 | + response = controller.getresponse() |
36 | 36 |
|
37 | | - if response is not None: |
38 | | - if response.messages.resultCode == "Ok": |
39 | | - if hasattr(response.transactionResponse, 'messages') == True: |
40 | | - print ('Successfully created transaction with Transaction ID: %s' % response.transactionResponse.transId); |
41 | | - print ("Payer Id : %s " % response.transactionResponse.secureAcceptance.PayerID) |
42 | | - print ('Transaction Response Code: %s' % response.transactionResponse.responseCode); |
43 | | - print ('Message Code: %s' % response.transactionResponse.messages.message[0].code); |
44 | | - print ('Description: %s' % response.transactionResponse.messages.message[0].description); |
45 | | - else: |
46 | | - print ('Failed Transaction.'); |
47 | | - if hasattr(response.transactionResponse, 'errors') == True: |
48 | | - print ('Error Code: %s' % str(response.transactionResponse.errors.error[0].errorCode)); |
49 | | - print ('Error message: %s' % response.transactionResponse.errors.error[0].errorText); |
50 | | - else: |
51 | | - print ('Failed Transaction.'); |
52 | | - if hasattr(response, 'transactionResponse') == True and hasattr(response.transactionResponse, 'errors') == True: |
53 | | - print ('Error Code: %s' % str(response.transactionResponse.errors.error[0].errorCode)); |
54 | | - print ('Error message: %s' % response.transactionResponse.errors.error[0].errorText); |
55 | | - else: |
56 | | - print ('Error Code: %s' % response.messages.message[0]['code'].text); |
57 | | - print ('Error message: %s' % response.messages.message[0]['text'].text); |
58 | | - else: |
59 | | - print ('Null Response.'); |
| 37 | + if response is not None: |
| 38 | + if response.messages.resultCode == "Ok": |
| 39 | + if hasattr(response.transactionResponse, 'messages') == True: |
| 40 | + print ('Successfully created transaction with Transaction ID: %s' % response.transactionResponse.transId); |
| 41 | + print ("Payer Id : %s " % response.transactionResponse.secureAcceptance.PayerID) |
| 42 | + print ('Transaction Response Code: %s' % response.transactionResponse.responseCode); |
| 43 | + print ('Message Code: %s' % response.transactionResponse.messages.message[0].code); |
| 44 | + print ('Description: %s' % response.transactionResponse.messages.message[0].description); |
| 45 | + else: |
| 46 | + print ('Failed Transaction.'); |
| 47 | + if hasattr(response.transactionResponse, 'errors') == True: |
| 48 | + print ('Error Code: %s' % str(response.transactionResponse.errors.error[0].errorCode)); |
| 49 | + print ('Error message: %s' % response.transactionResponse.errors.error[0].errorText); |
| 50 | + else: |
| 51 | + print ('Failed Transaction.'); |
| 52 | + if hasattr(response, 'transactionResponse') == True and hasattr(response.transactionResponse, 'errors') == True: |
| 53 | + print ('Error Code: %s' % str(response.transactionResponse.errors.error[0].errorCode)); |
| 54 | + print ('Error message: %s' % response.transactionResponse.errors.error[0].errorText); |
| 55 | + else: |
| 56 | + print ('Error Code: %s' % response.messages.message[0]['code'].text); |
| 57 | + print ('Error message: %s' % response.messages.message[0]['text'].text); |
| 58 | + else: |
| 59 | + print ('Null Response.'); |
60 | 60 |
|
61 | | - return response |
| 61 | + return response |
62 | 62 |
|
63 | 63 | if(os.path.basename(__file__) == os.path.basename(sys.argv[0])): |
64 | | - authorization_only_continued() |
| 64 | + authorization_only_continued() |
0 commit comments