def get_list_of_subscriptions(self): self.transaction = apicontractsv1.ARBGetSubscriptionListRequest() self.transaction.merchantAuthentication = self.merchant_auth self.transaction.searchType = apicontractsv1.ARBGetSubscriptionListSearchTypeEnum.subscriptionActive self.controller = ARBGetSubscriptionListController(self.transaction) self.controller.execute() # Work on the response response = self.controller.getresponse() if response.messages.resultCode == apicontractsv1.messageTypeEnum.Ok: return response.subscriptionDetails.subscriptionDetail
def get_list_of_subscription(): merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = constants.apiLoginId merchantAuth.transactionKey = constants.transactionKey sorting = apicontractsv1.ARBGetSubscriptionListSorting() sorting.orderBy = apicontractsv1.ARBGetSubscriptionListOrderFieldEnum.id sorting.orderDescending = "false" paging = apicontractsv1.Paging() paging.limit = 100 paging.offset = 1 request = apicontractsv1.ARBGetSubscriptionListRequest() request.merchantAuthentication = merchantAuth request.refId = "Sample" request.searchType = apicontractsv1.ARBGetSubscriptionListSearchTypeEnum.subscriptionInactive request.sorting = sorting request.paging = paging controller = ARBGetSubscriptionListController(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 print "Total Number In Results : %s" % response.totalNumInResultSet else: print "ERROR" print "Message Code : %s" % response.messages.message[0].code print "Message text : %s" % response.messages.message[0].text return response
def get_list_of_subscriptions(): """get list of subscriptions""" merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = constants.apiLoginId merchantAuth.transactionKey = constants.transactionKey # set sorting parameters sorting = apicontractsv1.ARBGetSubscriptionListSorting() sorting.orderBy = apicontractsv1.ARBGetSubscriptionListOrderFieldEnum.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.ARBGetSubscriptionListRequest() request.merchantAuthentication = merchantAuth request.refId = "Sample" request.searchType = apicontractsv1.ARBGetSubscriptionListSearchTypeEnum.subscriptionInactive request.sorting = sorting request.paging = paging controller = ARBGetSubscriptionListController(request) controller.execute() # Work on the response response = controller.getresponse() if response is not None: if response.messages.resultCode == apicontractsv1.messageTypeEnum.Ok: if hasattr(response, 'subscriptionDetails'): print('Successfully retrieved subscription 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 subscription in response.subscriptionDetails.subscriptionDetail: print('Subscription Id: %s' % subscription.id) print('Subscription Name: %s' % subscription.name) print('Subscription Status: %s' % subscription.status) print('Customer Profile Id: %s' % subscription.customerProfileId) print() else: if response.messages is not None: print('Failed to get subscription 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 * merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name = '5KP3u95bQpv' merchantAuth.transactionKey = '4Ktq966gC55GAX7S' sorting = apicontractsv1.ARBGetSubscriptionListSorting() sorting.orderBy = apicontractsv1.ARBGetSubscriptionListOrderFieldEnum.id sorting.orderDescending = "false" paging = apicontractsv1.Paging() paging.limit = 1000 paging.offset = 1 request = apicontractsv1.ARBGetSubscriptionListRequest() request.merchantAuthentication = merchantAuth request.refId = "Sample" request.searchType = apicontractsv1.ARBGetSubscriptionListSearchTypeEnum.subscriptionInactive request.sorting = sorting request.paging = paging controller = ARBGetSubscriptionListController(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