-
Notifications
You must be signed in to change notification settings - Fork 76
PR1992-getaujobdetails added #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kapilkumar99
wants to merge
4
commits into
AuthorizeNet:master
Choose a base branch
from
kapilkumar99:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
146 changes: 146 additions & 0 deletions
146
TransactionReporting/get-account-updater-job-details.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); | ||
gnongsie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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()))) | ||
gnongsie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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<auupdate.length;i++) | ||
{ | ||
|
||
console.log("**** AU Update Start ****'") | ||
console.log("\t" +'customerProfileID:'+ auupdate[i].getCustomerProfileID()); | ||
console.log("\t" +'customerPaymentProfileID:'+ auupdate[i].getCustomerPaymentProfileID()); | ||
console.log("\t" +'customerFirstname:'+ auupdate[i].getFirstName()); | ||
console.log("\t" +'customerLast name:'+ auupdate[i].getLastName()); | ||
console.log("\t" +'UpdateTimeUTC:'+ auupdate[i].getUpdateTimeUTC()); | ||
console.log("\t" +'AuReasonCode:'+ auupdate[i].getAuReasonCode()); | ||
console.log("\t" +'ReasonDescription:'+ auupdate[i].getReasonDescription()); | ||
gnongsie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
//if(audetails in ApiContracts.ListOfAUDetailsType.AuUpdateType){ | ||
|
||
if ((auupdate[i].getNewCreditCard())!=null){ | ||
var newcreditcard=auupdate[i].getNewCreditCard() | ||
console.log("Fetching new credit crd details:-") | ||
console.log("\t" +'CardNumber:'+ newcreditcard.getCardNumber()) | ||
console.log("\t" +'expirationDate:'+ newcreditcard.getExpirationDate()) | ||
console.log("\t" +'cardType:'+ newcreditcard.getCardType()) | ||
} | ||
if ((auupdate[i].getOldCreditCard())!=null){ | ||
var oldcreditcard=auupdate[i].getOldCreditCard() | ||
console.log("old credit crd details:-") | ||
console.log("\t" +'CardNumber:'+ newcreditcard.getCardNumber()) | ||
console.log("\t" +'expirationDate:'+ newcreditcard.getExpirationDate()) | ||
console.log("\t" +'cardType:'+ newcreditcard.getCardType()) | ||
} | ||
if ((auupdate[i].getSubscriptionIdList())!=null){ | ||
console.log("\t" +'SubscriptionIdlist:'); | ||
|
||
var subscriptionids=auupdate[i].getSubscriptionIdList() | ||
var subs=subscriptionids.subscriptionId | ||
for (var j=0; j<subs.length; j++){ | ||
console.log("\t" +'SubscriptionId:'+ subs[j])} | ||
} | ||
console.log("**** AU Update END ****'") | ||
} | ||
|
||
|
||
var audelete=audetails.auDelete | ||
for (var i=0;i< audelete.length;i++){ | ||
console.log("**** AU Delete Start ****'") | ||
console.log("\t" +'customerProfileID:'+ audelete[i].getCustomerProfileID()); | ||
console.log("\t" +'customerPaymentProfileID:'+ audelete[i].getCustomerPaymentProfileID()); | ||
console.log("\t" +'customerFirstname:'+ audelete[i].getFirstName()); | ||
console.log("\t" +'customerLast name:'+ audelete[i].getLastName()); | ||
console.log("\t" +'UpdateTimeUTC:'+ audelete[i].getUpdateTimeUTC()); | ||
console.log("\t" +'AuReasonCode:'+ audelete[i].getAuReasonCode()); | ||
console.log("\t" +'ReasonDescription:'+ audelete[i].getReasonDescription()); | ||
|
||
if(( audelete[i].getCreditCard())!=null){ | ||
var creditcard= audelete[i].getCreditCard() | ||
console.log("\t" +'CardNumber:'+ creditcard.getCardNumber()) | ||
console.log("\t" +'expirationDate:'+ creditcard.getExpirationDate()) | ||
console.log("\t" +'cardType:'+ creditcard.getCardType()) | ||
} | ||
if (( audelete[i].getSubscriptionIdList())!=null){ | ||
console.log("\t" +'SubscriptionIdlist:'); | ||
var subscriptionids= audelete[i].getSubscriptionIdList() | ||
var subs=subscriptionids.subscriptionId | ||
for (var j=0; j<subs.length; j++){ | ||
console.log("\t" +'SubscriptionId:'+ subs[j])} | ||
} | ||
console.log("**** AU Delete END ****'") | ||
} | ||
|
||
|
||
|
||
|
||
gnongsie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
} | ||
else { | ||
console.log('Result Code: ' + response.getMessages().getResultCode()); | ||
console.log('Error Code: ' + response.getMessages().getMessage()[0].getCode()); | ||
console.log('Error message: ' + response.getMessages().getMessage()[0].getText()); | ||
|
||
} | ||
} | ||
else { | ||
console.log('Null response received'); | ||
} | ||
|
||
callback(response); | ||
}); | ||
} | ||
|
||
|
||
if (require.main === module) { | ||
getaccountupdaterJobDetails(function () { | ||
console.log('getAUJobDetails call complete.'); | ||
}); | ||
} | ||
|
||
module.exports.getaccountupdaterJobDetails = getaccountupdaterJobDetails; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.