def get_unsettled_transaction_list(): merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = constants.apiLoginId merchantAuth.transactionKey = constants.transactionKey unsettledTransactionListRequest = apicontractsv1.getUnsettledTransactionListRequest() unsettledTransactionListRequest.merchantAuthentication = merchantAuth unsettledTransactionListController = getUnsettledTransactionListController(unsettledTransactionListRequest) unsettledTransactionListController.execute() unsettledTransactionListResponse = unsettledTransactionListController.getresponse() if unsettledTransactionListResponse is not None: if unsettledTransactionListResponse.messages.resultCode == apicontractsv1.messageTypeEnum.Ok: print('Successfully got unsettled transaction list!') for transaction in unsettledTransactionListResponse.transactions.transaction: print('Transaction Id : %s' % transaction.transId) print('Transaction Status : %s' % transaction.transactionStatus) print('Amount Type : %s' % transaction.accountType) print('Settle Amount : %s' % transaction.settleAmount) if unsettledTransactionListResponse.messages: print('Message Code : %s' % unsettledTransactionListResponse.messages.message[0]['code'].text) print('Message Text : %s' % unsettledTransactionListResponse.messages.message[0]['text'].text) else: if unsettledTransactionListResponse.messages: print('Failed to get unsettled transaction list.\nCode:%s \nText:%s' % (unsettledTransactionListResponse.messages.message[0]['code'].text,unsettledTransactionListResponse.messages.message[0]['text'].text)) return unsettledTransactionListResponse
def get_unsettled_transaction_list(): """get unsettled transaction list""" merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = constants.apiLoginId merchantAuth.transactionKey = constants.transactionKey # set sorting parameters sorting = apicontractsv1.TransactionListSorting() sorting.orderBy = apicontractsv1.TransactionListOrderFieldEnum.id sorting.orderDescending = True # set paging and offset parameters paging = apicontractsv1.Paging() # Paging limit can be up to 1000 for this request paging.limit = 20 paging.offset = 1 request = apicontractsv1.getUnsettledTransactionListRequest() request.merchantAuthentication = merchantAuth request.refId = "Sample" request.sorting = sorting request.paging = paging unsettledTransactionListController = getUnsettledTransactionListController( request) unsettledTransactionListController.execute() # Work on the response response = unsettledTransactionListController.getresponse() if response is not None: if response.messages.resultCode == apicontractsv1.messageTypeEnum.Ok: if hasattr(response, 'transactions'): print('Successfully retrieved transaction list.') if response.messages is not None: print('Message Code: %s' % response.messages.message[0]['code'].text) print('Message Text: %s' % response.messages.message[0]['text'].text) print('Total Number In Results: %s' % response.totalNumInResultSet) print() for transaction in response.transactions.transaction: print('Transaction Id: %s' % transaction.transId) print('Transaction Status: %s' % transaction.transactionStatus) if hasattr(transaction, 'accountType'): print('Account Type: %s' % transaction.accountType) print('Settle Amount: %.2f' % transaction.settleAmount) if hasattr(transaction, 'profile'): print('Customer Profile ID: %s' % transaction.profile.customerProfileId) print() else: if response.messages is not None: print('Failed to get transaction list.') print('Code: %s' % (response.messages.message[0]['code'].text)) print('Text: %s' % (response.messages.message[0]['text'].text)) else: if response.messages is not None: print('Failed to get transaction list.') print('Code: %s' % (response.messages.message[0]['code'].text)) print('Text: %s' % (response.messages.message[0]['text'].text)) else: print('Error. No response received.') return response
from authorizenet import apicontractsv1 from authorizenet.apicontrollers import * from decimal import * merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = '5KP3u95bQpv' merchantAuth.transactionKey = '4Ktq966gC55GAX7S' unsettledTransactionListRequest = apicontractsv1.getUnsettledTransactionListRequest( ) unsettledTransactionListRequest.merchantAuthentication = merchantAuth unsettledTransactionListController = getUnsettledTransactionListController( unsettledTransactionListRequest) unsettledTransactionListController.execute() unsettledTransactionListResponse = unsettledTransactionListController.getresponse( ) if unsettledTransactionListResponse is not None: if unsettledTransactionListResponse.messages.resultCode == apicontractsv1.messageTypeEnum.Ok: print('Successfully got unsettled transaction list!') for transaction in unsettledTransactionListResponse.transactions.transaction: print('Transaction Id : %s' % transaction.transId) print('Transaction Status : %s' % transaction.transactionStatus) print('Amount Type : %s' % transaction.accountType) print('Settle Amount : %s' % transaction.settleAmount) if unsettledTransactionListResponse.messages:
def get_transaction_list(ds, **kwargs): batch_ids = kwargs['ti'].xcom_pull(task_ids='get_batch_ids') transaction_ids = [] transaction_unsettled_ids = [] for b in batch_ids: transactionListRequest = apicontractsv1.getTransactionListRequest() transactionListRequest.merchantAuthentication = merchantAuth transactionListRequest.batchId = str(b) paging = apicontractsv1.Paging() paging.limit = '1000' paging.offset = '1' transactionListRequest.paging = paging transactionListController = getTransactionListController(transactionListRequest) transactionListController.setenvironment(ENV) transactionListController.execute() transactionListResponse = transactionListController.getresponse() if transactionListResponse is not None: if transactionListResponse.messages.resultCode == apicontractsv1.messageTypeEnum.Ok: if hasattr(transactionListResponse, 'transactions'): print('Successfully got transaction list!') try: for transaction in transactionListResponse.transactions.transaction: transaction_ids.append(transaction.transId) except: print('No records in batch id') if transactionListResponse.messages is not None: print('Message Code : %s' % transactionListResponse.messages.message[0].code) print('Message Text : %s' % transactionListResponse.messages.message[0].text) else: if transactionListResponse.messages is not None: print('Failed to get transaction list.\nCode:%s \nText:%s' % ( transactionListResponse.messages.message[0].code, transactionListResponse.messages.message[0].text)) unsettledTransactionListRequest = apicontractsv1.getUnsettledTransactionListRequest() unsettledTransactionListRequest.merchantAuthentication = merchantAuth paging = apicontractsv1.Paging() paging.limit = '1000' paging.offset = '1' unsettledTransactionListRequest.paging = paging unsettledTransactionListController = getUnsettledTransactionListController(unsettledTransactionListRequest) unsettledTransactionListController.setenvironment(ENV) unsettledTransactionListController.execute() unsettledTransactionListResponse = unsettledTransactionListController.getresponse() if unsettledTransactionListResponse is not None: if unsettledTransactionListResponse.messages.resultCode == apicontractsv1.messageTypeEnum.Ok: if hasattr(unsettledTransactionListResponse, 'transactions'): print('Successfully gotten unsettled transaction list!') try: for transaction in unsettledTransactionListResponse.transactions.transaction: transaction_unsettled_ids.append(transaction.transId) except: print('No unsettled transaction ids') if unsettledTransactionListResponse.messages is not None: print('Message Code : %s' % unsettledTransactionListResponse.messages.message[0].code) print('Message Text : %s' % unsettledTransactionListResponse.messages.message[0].text) else: if unsettledTransactionListResponse.messages is not None: print('Failed to get unsettled transaction list.\nCode:%s \nText:%s' % ( unsettledTransactionListResponse.messages.message[0].code, unsettledTransactionListResponse.messages.message[0].text)) return {'transaction_ids': transaction_ids, 'transaction_unsettled_ids': transaction_unsettled_ids}
def get_unsettled_transaction_list(): """get unsettled transaction list""" merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = constants.apiLoginId merchantAuth.transactionKey = constants.transactionKey # set sorting parameters sorting = apicontractsv1.TransactionListSorting() sorting.orderBy = apicontractsv1.TransactionListOrderFieldEnum.id sorting.orderDescending = True # set paging and offset parameters paging = apicontractsv1.Paging() # Paging limit can be up to 1000 for this request paging.limit = 20 paging.offset = 1 request = apicontractsv1.getUnsettledTransactionListRequest() request.merchantAuthentication = merchantAuth request.refId = "Sample" request.sorting = sorting request.paging = paging unsettledTransactionListController = getUnsettledTransactionListController(request) unsettledTransactionListController.execute() # Work on the response response = unsettledTransactionListController.getresponse() if response is not None: if response.messages.resultCode == apicontractsv1.messageTypeEnum.Ok: if hasattr(response, 'transactions'): print('Successfully retrieved transaction list.') if response.messages is not None: print('Message Code: %s' % response.messages.message[0]['code'].text) print('Message Text: %s' % response.messages.message[0]['text'].text) print('Total Number In Results: %s' % response.totalNumInResultSet) print() for transaction in response.transactions.transaction: print('Transaction Id: %s' % transaction.transId) print('Transaction Status: %s' % transaction.transactionStatus) if hasattr(transaction, 'accountType'): print('Account Type: %s' % transaction.accountType) print('Settle Amount: %.2f' % transaction.settleAmount) if hasattr(transaction, 'profile'): print('Customer Profile ID: %s' % transaction.profile.customerProfileId) print() else: if response.messages is not None: print('Failed to get transaction list.') print('Code: %s' % (response.messages.message[0]['code'].text)) print('Text: %s' % (response.messages.message[0]['text'].text)) else: if response.messages is not None: print('Failed to get transaction list.') print('Code: %s' % (response.messages.message[0]['code'].text)) print('Text: %s' % (response.messages.message[0]['text'].text)) else: print('Error. No response received.') return response
from authorizenet import apicontractsv1 from authorizenet.apicontrollers import * from decimal import * merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = '5KP3u95bQpv' merchantAuth.transactionKey = '4Ktq966gC55GAX7S' unsettledTransactionListRequest = apicontractsv1.getUnsettledTransactionListRequest() unsettledTransactionListRequest.merchantAuthentication = merchantAuth unsettledTransactionListController = getUnsettledTransactionListController(unsettledTransactionListRequest) unsettledTransactionListController.execute() unsettledTransactionListResponse = unsettledTransactionListController.getresponse() if unsettledTransactionListResponse is not None: if unsettledTransactionListResponse.messages.resultCode == apicontractsv1.messageTypeEnum.Ok: print('Successfully got unsettled transaction list!') for transaction in unsettledTransactionListResponse.transactions.transaction: print('Transaction Id : %s' % transaction.transId) print('Transaction Status : %s' % transaction.transactionStatus) print('Amount Type : %s' % transaction.accountType) print('Settle Amount : %s' % transaction.settleAmount) if unsettledTransactionListResponse.messages: print('Message Code : %s' % unsettledTransactionListResponse.messages.message[0].code) print('Message Text : %s' % unsettledTransactionListResponse.messages.message[0].text) else: