From 1e81b5f499c09245899a722e417be9fb3557fda9 Mon Sep 17 00:00:00 2001 From: sudhirkumar2018 <36911383+sudhirkumar2018@users.noreply.github.com> Date: Tue, 30 Oct 2018 15:39:03 +0530 Subject: [PATCH 1/2] PR1992_GetAUJobDetails_sample_code_modifications_python 1.Added new sample code get-account-updater-job-details 2.Added code for subscription id in auUpdate and auDelete 3.added test method for the same in the testrunner file --- .../get-account-updater-job-details.py | 100 ++++++++++++++++++ test-runner.py | 6 ++ 2 files changed, 106 insertions(+) create mode 100644 TransactionReporting/get-account-updater-job-details.py diff --git a/TransactionReporting/get-account-updater-job-details.py b/TransactionReporting/get-account-updater-job-details.py new file mode 100644 index 0000000..8d2bc18 --- /dev/null +++ b/TransactionReporting/get-account-updater-job-details.py @@ -0,0 +1,100 @@ +import os +import sys +from authorizenet import apicontractsv1 +from authorizenet.apicontrollers import getAUJobDetailsController +from authorizenet.constants import constants + +def get_account_updater_job_details(): + merchantAuth = apicontractsv1.merchantAuthenticationType() + merchantAuth.name = constants.apiLoginId + merchantAuth.transactionKey = constants.transactionKey + + paging = apicontractsv1.Paging() + # Paging limit can be up to 1000 for this request + paging.limit = 1000 + paging.offset = 2 + request = apicontractsv1.getAUJobDetailsRequest() + request.merchantAuthentication = merchantAuth + request.paging = paging + request.month = "2018-08" + request.modifiedTypeFilter = "all" + request.refId = "123456" + controller = getAUJobDetailsController(request) + controller.execute() + response = controller.getresponse() + + if response is not None: + if response.messages.resultCode == apicontractsv1.messageTypeEnum.Ok: + + if hasattr(response, 'auDetails'): + print('SUCCESS: Get Account Updater job details for Month and year :' + request.month) + 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('\n') + + for details in response.auDetails.auDelete: + print('Deleted Profile:') + # auDelete Start + print('Customer Payment Profile ID: %s' % details.customerPaymentProfileID) + print('Customer Profile ID: %s' % details.customerProfileID) + print('First Name: %s' % details.firstName) + print('Last Name: %s' % details.lastName) + print('AU Reason Code: %s' % details.auReasonCode) + print('Reason Description: %s' % details.reasonDescription) + print('Update Time UTC: %s' % details.updateTimeUTC) + print(' ') + # fetching card details: + print('Card Details:') + print('Card Number: %s' % details.creditCard.cardNumber) + print('Card Type: %s' % details.creditCard.cardType) + print('Expiration Date: %s' % details.creditCard.expirationDate) + # fetching deleted subscriptions + if hasattr(details.subscriptionIdList, 'subscriptionId') == True: + print(' ') + print('Subscription Id: %s' % details.subscriptionIdList.subscriptionId) + # auDelete End + print('\n') + + for details in response.auDetails.auUpdate: + + # auUpdate Start + print('Updated Profile:') + print('Customer Payment Profile ID: %s' % details.customerPaymentProfileID) + print('Customer Profile ID: %s' % details.customerProfileID) + print('First Name: %s' % details.firstName) + print('Last Name: %s' % details.lastName) + print('AU Reason Code: %s' % details.auReasonCode) + print('Reason Description: %s' % details.reasonDescription) + print('Update Time UTC: %s' % details.updateTimeUTC) + # fetching Old card details: + print('Old Card details:') + print('old Card Number: %s' % details.oldCreditCard.cardNumber) + print('old Card Type: %s' % details.oldCreditCard.cardType) + print('old Expiration Date: %s' % details.oldCreditCard.expirationDate) + # fetching New card details: + print('Old Card details:') + print('new Card Number: %s' % details.newCreditCard.cardNumber) + print('new Card Type: %s' % details.newCreditCard.cardType) + print('new Expiration Date: %s' % details.newCreditCard.expirationDate) + # fetching updated Subscription + if hasattr(details.subscriptionIdList, 'subscriptionId') == True: + print('Subscription Id: %s' % details.subscriptionIdList.subscriptionId) + + else: + print('Failed to get Get Account Updater job details for Month and year :' + request.month) + print('Message Code: %s' % response.messages.message[0]['code'].text) + print('Message Text: %s' % response.messages.message[0]['text'].text) + + else: + print('Failed to get Get Account Updater job details for Month and year :' + request.month) + print('Message Code: %s' % response.messages.message[0]['code'].text) + print('Message Text: %s' % response.messages.message[0]['text'].text) + else: + print('No response received') + + +if(os.path.basename(__file__) == os.path.basename(sys.argv[0])): + get_account_updater_job_details() + diff --git a/test-runner.py b/test-runner.py index 443d3a3..9a3cf64 100644 --- a/test-runner.py +++ b/test-runner.py @@ -602,6 +602,12 @@ def update_held_transaction(self): print("update_held_transaction") modl = imp.load_source('modulename', 'PaymentTransactions/update-held-transaction.py') return modl.update_held_transaction("12345") + + def get_account_updater_job_details(self): + print("get_account_updater_job_details") + modl = imp.load_source('modulename', 'TransactionReporting/get-account-updater-job-details.py') + return modl.get_account_updater_job_details() + def validate_response(self, response): if(response is None): From ac068c04ced2f51833c799f43ed2694e7e03292f Mon Sep 17 00:00:00 2001 From: sudhirkumar2018 <36911383+sudhirkumar2018@users.noreply.github.com> Date: Mon, 12 Nov 2018 11:04:45 +0530 Subject: [PATCH 2/2] Update TransactionReporting/get-account-updater-job-details.py 1. Removed 'and year'. 2. Removed extra space fromCustomer Profile ID and placed it before Customer Payment Profile Id. --- TransactionReporting/get-account-updater-job-details.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/TransactionReporting/get-account-updater-job-details.py b/TransactionReporting/get-account-updater-job-details.py index 8d2bc18..6376127 100644 --- a/TransactionReporting/get-account-updater-job-details.py +++ b/TransactionReporting/get-account-updater-job-details.py @@ -27,7 +27,7 @@ def get_account_updater_job_details(): if response.messages.resultCode == apicontractsv1.messageTypeEnum.Ok: if hasattr(response, 'auDetails'): - print('SUCCESS: Get Account Updater job details for Month and year :' + request.month) + print('SUCCESS: Get Account Updater job details for Month:' + request.month) 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) @@ -37,8 +37,8 @@ def get_account_updater_job_details(): for details in response.auDetails.auDelete: print('Deleted Profile:') # auDelete Start + print('Customer Profile ID: %s' % details.customerProfileID) print('Customer Payment Profile ID: %s' % details.customerPaymentProfileID) - print('Customer Profile ID: %s' % details.customerProfileID) print('First Name: %s' % details.firstName) print('Last Name: %s' % details.lastName) print('AU Reason Code: %s' % details.auReasonCode) @@ -61,8 +61,8 @@ def get_account_updater_job_details(): # auUpdate Start print('Updated Profile:') + print('Customer Profile ID: %s' % details.customerProfileID) print('Customer Payment Profile ID: %s' % details.customerPaymentProfileID) - print('Customer Profile ID: %s' % details.customerProfileID) print('First Name: %s' % details.firstName) print('Last Name: %s' % details.lastName) print('AU Reason Code: %s' % details.auReasonCode) @@ -83,7 +83,7 @@ def get_account_updater_job_details(): print('Subscription Id: %s' % details.subscriptionIdList.subscriptionId) else: - print('Failed to get Get Account Updater job details for Month and year :' + request.month) + print('Failed to get Get Account Updater job details for Month:' + request.month) print('Message Code: %s' % response.messages.message[0]['code'].text) print('Message Text: %s' % response.messages.message[0]['text'].text)