| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e2533d2 commit 742bea8
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -32,12 +32,14 @@ def get_transaction_details(transId): | |||
| 32 | 32 | print('Settle Amount : %s' % transactionDetailsResponse.transaction.settleAmount) | |
| 33 | 33 | if hasattr(transactionDetailsResponse.transaction, 'tax') == True: | |
| 34 | 34 | print('Tax : %s' % transactionDetailsResponse.transaction.tax.amount) | |
| 35 | + if hasattr(transactionDetailsResponse.transaction, 'profile'): | ||
| 36 | + print('Customer Profile Id : %s' % transactionDetailsResponse.transaction.profile.customerProfileId) | ||
| 35 | 37 | ||
| 36 | - if transactionDetailsResponse.messages: | ||
| 38 | + if transactionDetailsResponse.messages is not None: | ||
| 37 | 39 | print('Message Code : %s' % transactionDetailsResponse.messages.message[0]['code'].text) | |
| 38 | 40 | print('Message Text : %s' % transactionDetailsResponse.messages.message[0]['text'].text) | |
| 39 | 41 | else: | |
| 40 | - if transactionDetailsResponse.messages: | ||
| 42 | + if transactionDetailsResponse.messages is not None: | ||
| 41 | 43 | print('Failed to get transaction details.\nCode:%s \nText:%s' % (transactionDetailsResponse.messages.message[0]['code'].text,transactionDetailsResponse.messages.message[0]['text'].text)) | |
| 42 | 44 | ||
| 43 | 45 | return transactionDetailsResponse | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,44 @@ | |||
| 1 | + import os, sys | ||
| 2 | + import imp | ||
| 3 | + | ||
| 4 | + from authorizenet import apicontractsv1 | ||
| 5 | + from authorizenet.apicontrollers import * | ||
| 6 | + constants = imp.load_source('modulename', 'constants.py') | ||
| 7 | + from decimal import * | ||
| 8 | + | ||
| 9 | + def get_transaction_list_for_customer(customerProfileId): | ||
| 10 | + merchantAuth = apicontractsv1.merchantAuthenticationType() | ||
| 11 | + merchantAuth.name = constants.apiLoginId | ||
| 12 | + merchantAuth.transactionKey = constants.transactionKey | ||
| 13 | + | ||
| 14 | + transactionListForCustomerRequest = apicontractsv1.getTransactionListForCustomerRequest() | ||
| 15 | + transactionListForCustomerRequest.merchantAuthentication = merchantAuth | ||
| 16 | + transactionListForCustomerRequest.customerProfileId = customerProfileId | ||
| 17 | + | ||
| 18 | + transactionListForCustomerController = getTransactionListForCustomerController(transactionListForCustomerRequest) | ||
| 19 | + | ||
| 20 | + transactionListForCustomerController.execute() | ||
| 21 | + | ||
| 22 | + transactionListForCustomerResponse = transactionListForCustomerController.getresponse() | ||
| 23 | + | ||
| 24 | + if transactionListForCustomerResponse is not None: | ||
| 25 | + if transactionListForCustomerResponse.messages.resultCode == apicontractsv1.messageTypeEnum.Ok: | ||
| 26 | + print('Successfully got transaction list!') | ||
| 27 | + | ||
| 28 | + for transaction in transactionListForCustomerResponse.transactions.transaction: | ||
| 29 | + print('Transaction Id : %s' % transaction.transId) | ||
| 30 | + print('Transaction Status : %s' % transaction.transactionStatus) | ||
| 31 | + print('Amount Type : %s' % transaction.accountType) | ||
| 32 | + print('Settle Amount : %s' % transaction.settleAmount) | ||
| 33 | + | ||
| 34 | + if transactionListForCustomerResponse.messages is not None: | ||
| 35 | + print('Message Code : %s' % transactionListForCustomerResponse.messages.message[0]['code'].text) | ||
| 36 | + print('Message Text : %s' % transactionListForCustomerResponse.messages.message[0]['text'].text) | ||
| 37 | + else: | ||
| 38 | + if transactionListForCustomerResponse.messages is not None: | ||
| 39 | + print('Failed to get transaction list.\nCode:%s \nText:%s' % (transactionListForCustomerResponse.messages.message[0]['code'].text,transactionListForCustomerResponse.messages.message[0]['text'].text)) | ||
| 40 | + | ||
| 41 | + return transactionListForCustomerResponse | ||
| 42 | + | ||
| 43 | + if(os.path.basename(__file__) == os.path.basename(sys.argv[0])): | ||
| 44 | + get_transaction_list_for_customer('36152127') | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,6 +30,8 @@ def get_transaction_list(): | |||
| 30 | 30 | print('Transaction Status : %s' % transaction.transactionStatus) | |
| 31 | 31 | print('Amount Type : %s' % transaction.accountType) | |
| 32 | 32 | print('Settle Amount : %s' % transaction.settleAmount) | |
| 33 | + if hasattr(transaction, 'profile'): | ||
| 34 | + print('Customer Profile Id : %s' % transaction.profile.customerProfileId) | ||
| 33 | 35 | ||
| 34 | 36 | if transactionListResponse.messages is not None: | |
| 35 | 37 | print('Message Code : %s' % transactionListResponse.messages.message[0]['code'].text) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,12 +29,14 @@ def get_unsettled_transaction_list(): | |||
| 29 | 29 | print('Transaction Status : %s' % transaction.transactionStatus) | |
| 30 | 30 | print('Amount Type : %s' % transaction.accountType) | |
| 31 | 31 | print('Settle Amount : %s' % transaction.settleAmount) | |
| 32 | + if hasattr(transaction, 'profile'): | ||
| 33 | + print('Customer Profile Id : %s' % transaction.profile.customerProfileId) | ||
| 32 | 34 | ||
| 33 | - if unsettledTransactionListResponse.messages: | ||
| 35 | + if unsettledTransactionListResponse.messages is not None: | ||
| 34 | 36 | print('Message Code : %s' % unsettledTransactionListResponse.messages.message[0]['code'].text) | |
| 35 | 37 | print('Message Text : %s' % unsettledTransactionListResponse.messages.message[0]['text'].text) | |
| 36 | 38 | else: | |
| 37 | - if unsettledTransactionListResponse.messages: | ||
| 39 | + if unsettledTransactionListResponse.messages is not None: | ||
| 38 | 40 | print('Failed to get unsettled transaction list.\nCode:%s \nText:%s' % (unsettledTransactionListResponse.messages.message[0]['code'].text,unsettledTransactionListResponse.messages.message[0]['text'].text)) | |
| 39 | 41 | ||
| 40 | 42 | return unsettledTransactionListResponse | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -47,6 +47,7 @@ get_batch_statistics 1 1 | |||
| 47 | 47 | get_settled_batch_list 1 1 | |
| 48 | 48 | get_transaction_details 1 0 | |
| 49 | 49 | get_transaction_list 1 1 | |
| 50 | + get_transaction_list_for_customer 1 1 | ||
| 50 | 51 | get_unsettled_transaction_list 1 0 | |
| 51 | 52 | create_visa_checkout_transaction 1 0 | |
| 52 | 53 | decrypt_visa_checkout_data 1 0 | |
| Back | FazBrowse Home | New Git URL |
0 commit comments