From 371f115fb5be893bf4d3f97f272bf72ce286d1dd Mon Sep 17 00:00:00 2001 From: naina Date: Wed, 14 Nov 2018 11:36:30 +0530 Subject: [PATCH 1/4] PR1992-getaujobdetails added --- .../get-account-updater-job-details.js | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 TransactionReporting/get-account-updater-job-details.js diff --git a/TransactionReporting/get-account-updater-job-details.js b/TransactionReporting/get-account-updater-job-details.js new file mode 100644 index 0000000..976b249 --- /dev/null +++ b/TransactionReporting/get-account-updater-job-details.js @@ -0,0 +1,146 @@ +'use strict'; + +var ApiContracts = require('authorizenet').APIContracts; +var ApiControllers = require('authorizenet').APIControllers; +var utils = require('../utils.js'); +var constants = require('../constants.js'); +var Map = require('collections/map');//added to iterate through loop by me + +function getaccountupdaterJobDetails(callback) { + var merchantAuthenticationType = new ApiContracts.MerchantAuthenticationType(); + merchantAuthenticationType.setName(constants.apiLoginKey); + merchantAuthenticationType.setTransactionKey(constants.transactionKey); + var month = '2018-08'; + var modifiedTypeFilter = 'all'; + var refId='123456' + var paging = new ApiContracts.Paging(); + paging.setLimit(36); + paging.setOffset(1); + var subscriptionId = [] ; + + var getRequest = new ApiContracts.GetAUJobDetailsRequest(); + getRequest.setMerchantAuthentication(merchantAuthenticationType); + getRequest.setMonth(month); + getRequest.setPaging(paging); + getRequest.setModifiedTypeFilter(modifiedTypeFilter); + getRequest.setRefId(refId); + + var ctrl = new ApiControllers.GetAUJobDetailsController(getRequest.getJSON()); + ctrl.execute(function () { + var apiResponse = ctrl.getResponse(); + var response = new ApiContracts.GetAUJobDetailsResponse(apiResponse); + //pretty print response + //console.log(JSON.stringify(response, null, 2)); + if (response != null) { + if (response.getMessages().getResultCode() == ApiContracts.MessageTypeEnum.OK) { + //console.log('Successfully created ' + response.getAuDetails()); + if (response.getAuDetails == null) + return response; + else{ + console.log('refId :'+response.refId) + console.log('Result Code: ' + response.getMessages().getResultCode()); + console.log('message:') + console.log('Code: ' + response.getMessages().getMessage()[0].getCode()); + console.log('text: ' + response.getMessages().getMessage()[0].getText()); + //console.log('Successfully created audetails ' + JSON.parse(JSON.stringify(response.getAuDetails().getAuUpdateOrAuDelete()))) + console.log('total no in result set is :-'+ response.totalNumInResultSet) + console.log('auupdate : '); + + var audetails = response.getAuDetails() + var auupdate=audetails.auUpdate + + for (var i=0;i Date: Wed, 14 Nov 2018 12:36:17 +0530 Subject: [PATCH 2/4] PR1992_getaujobdetails-comment --- .../get-account-updater-job-details.js | 68 +++++++------------ 1 file changed, 26 insertions(+), 42 deletions(-) diff --git a/TransactionReporting/get-account-updater-job-details.js b/TransactionReporting/get-account-updater-job-details.js index 976b249..ec30662 100644 --- a/TransactionReporting/get-account-updater-job-details.js +++ b/TransactionReporting/get-account-updater-job-details.js @@ -4,21 +4,20 @@ var ApiContracts = require('authorizenet').APIContracts; var ApiControllers = require('authorizenet').APIControllers; var utils = require('../utils.js'); var constants = require('../constants.js'); -var Map = require('collections/map');//added to iterate through loop by me + function getaccountupdaterJobDetails(callback) { var merchantAuthenticationType = new ApiContracts.MerchantAuthenticationType(); - merchantAuthenticationType.setName(constants.apiLoginKey); + merchantAuthenticationType.setName(constants.apiLoginKey); merchantAuthenticationType.setTransactionKey(constants.transactionKey); var month = '2018-08'; var modifiedTypeFilter = 'all'; - var refId='123456' + var refId = '123456' var paging = new ApiContracts.Paging(); paging.setLimit(36); paging.setOffset(1); var subscriptionId = [] ; - - var getRequest = new ApiContracts.GetAUJobDetailsRequest(); + var getRequest = new ApiContracts.GetAUJobDetailsRequest(); getRequest.setMerchantAuthentication(merchantAuthenticationType); getRequest.setMonth(month); getRequest.setPaging(paging); @@ -29,21 +28,16 @@ function getaccountupdaterJobDetails(callback) { ctrl.execute(function () { var apiResponse = ctrl.getResponse(); var response = new ApiContracts.GetAUJobDetailsResponse(apiResponse); - //pretty print response - //console.log(JSON.stringify(response, null, 2)); + if (response != null) { if (response.getMessages().getResultCode() == ApiContracts.MessageTypeEnum.OK) { - //console.log('Successfully created ' + response.getAuDetails()); + if (response.getAuDetails == null) return response; else{ console.log('refId :'+response.refId) console.log('Result Code: ' + response.getMessages().getResultCode()); - console.log('message:') - console.log('Code: ' + response.getMessages().getMessage()[0].getCode()); - console.log('text: ' + response.getMessages().getMessage()[0].getText()); - //console.log('Successfully created audetails ' + JSON.parse(JSON.stringify(response.getAuDetails().getAuUpdateOrAuDelete()))) - console.log('total no in result set is :-'+ response.totalNumInResultSet) + console.log('total no in result set is :-'+ response.totalNumInResultSet) console.log('auupdate : '); var audetails = response.getAuDetails() @@ -52,15 +46,15 @@ function getaccountupdaterJobDetails(callback) { for (var i=0;i Date: Wed, 14 Nov 2018 13:11:19 +0530 Subject: [PATCH 3/4] PR1992_getaujobdetails-comment --- .../get-account-updater-job-details.js | 164 +++++++++--------- 1 file changed, 81 insertions(+), 83 deletions(-) diff --git a/TransactionReporting/get-account-updater-job-details.js b/TransactionReporting/get-account-updater-job-details.js index ec30662..6735234 100644 --- a/TransactionReporting/get-account-updater-job-details.js +++ b/TransactionReporting/get-account-updater-job-details.js @@ -7,108 +7,106 @@ var constants = require('../constants.js'); function getaccountupdaterJobDetails(callback) { - var merchantAuthenticationType = new ApiContracts.MerchantAuthenticationType(); - merchantAuthenticationType.setName(constants.apiLoginKey); + var merchantAuthenticationType = new ApiContracts.MerchantAuthenticationType(); + merchantAuthenticationType.setName(constants.apiLoginKey); merchantAuthenticationType.setTransactionKey(constants.transactionKey); var month = '2018-08'; - var modifiedTypeFilter = 'all'; - var refId = '123456' - var paging = new ApiContracts.Paging(); + var modifiedTypeFilter = 'all'; + var refId = '123456' + var paging = new ApiContracts.Paging(); paging.setLimit(36); paging.setOffset(1); - var subscriptionId = [] ; - var getRequest = new ApiContracts.GetAUJobDetailsRequest(); + var subscriptionId = []; + var getRequest = new ApiContracts.GetAUJobDetailsRequest(); getRequest.setMerchantAuthentication(merchantAuthenticationType); getRequest.setMonth(month); getRequest.setPaging(paging); - getRequest.setModifiedTypeFilter(modifiedTypeFilter); - getRequest.setRefId(refId); - - var ctrl = new ApiControllers.GetAUJobDetailsController(getRequest.getJSON()); - ctrl.execute(function () { + getRequest.setModifiedTypeFilter(modifiedTypeFilter); + getRequest.setRefId(refId); + + var ctrl = new ApiControllers.GetAUJobDetailsController(getRequest.getJSON()); + ctrl.execute(function () { var apiResponse = ctrl.getResponse(); var response = new ApiContracts.GetAUJobDetailsResponse(apiResponse); - + if (response != null) { if (response.getMessages().getResultCode() == ApiContracts.MessageTypeEnum.OK) { - + if (response.getAuDetails == null) return response; - else{ - console.log('refId :'+response.refId) + else { + console.log('RefId :' + response.refId) console.log('Result Code: ' + response.getMessages().getResultCode()); - console.log('total no in result set is :-'+ response.totalNumInResultSet) - console.log('auupdate : '); + console.log('Total No In Result Set Is :-' + response.totalNumInResultSet) + var audetails = response.getAuDetails() + var auupdate = audetails.auUpdate + + for (var i = 0; i < auupdate.length; i++) { - var audetails = response.getAuDetails() - var auupdate=audetails.auUpdate - - for (var i=0;i Date: Wed, 14 Nov 2018 13:16:02 +0530 Subject: [PATCH 4/4] PR1992_getaujobdetails_comment --- TransactionReporting/get-account-updater-job-details.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TransactionReporting/get-account-updater-job-details.js b/TransactionReporting/get-account-updater-job-details.js index 6735234..7524ac8 100644 --- a/TransactionReporting/get-account-updater-job-details.js +++ b/TransactionReporting/get-account-updater-job-details.js @@ -44,8 +44,8 @@ function getaccountupdaterJobDetails(callback) { for (var i = 0; i < auupdate.length; i++) { console.log("**** AU Update Start ****'") - console.log("\t" + 'Profile ID:' + auupdate[i].getCustomerProfileID()); - console.log("\t" + 'Payment Profile ID:' + auupdate[i].getCustomerPaymentProfileID()); + console.log("\t" + 'Customer Profile ID:' + auupdate[i].getCustomerProfileID()); + console.log("\t" + 'Customer Payment Profile ID:' + auupdate[i].getCustomerPaymentProfileID()); console.log("\t" + 'First Name:' + auupdate[i].getFirstName()); console.log("\t" + 'Last Name:' + auupdate[i].getLastName()); console.log("\t" + 'Update Time UTC:' + auupdate[i].getUpdateTimeUTC()); @@ -80,7 +80,7 @@ function getaccountupdaterJobDetails(callback) { var audelete = audetails.auDelete for (var i = 0; i < audelete.length; i++) { console.log("**** AU Delete Start ****'") - console.log("\t" + ' Customer Profile ID:' + audelete[i].getCustomerProfileID()); + console.log("\t" + 'Customer Profile ID:' + audelete[i].getCustomerProfileID()); console.log("\t" + 'Customer Payment Profile ID:' + audelete[i].getCustomerPaymentProfileID()); console.log("\t" + 'First Name:' + audelete[i].getFirstName()); console.log("\t" + 'Last Name:' + audelete[i].getLastName());