-
Notifications
You must be signed in to change notification settings - Fork 457
Pr1992 getaujobdetails sample code java #83
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
dinsahu
wants to merge
7
commits into
AuthorizeNet:master
Choose a base branch
from
dinsahu:PR1992_getaujobdetails_sample-code_-java
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 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
582d11f
PR1992_getaujobdetails_sample code_modifications_ java
dinsahu 5e4aaa6
PR1992_getaujobdetails_sample code_modifications_ java
dinsahu 9cd2588
Merge branch 'master' into PR1992_getaujobdetails_sample-code_-java
gnongsie e3671ff
Removed getTypeName() from GetAUJobDetails
dinsahu 2d6e7b5
Merge branch 'PR1992_getaujobdetails_sample-code_-java' of https://gi…
dinsahu f47e24d
Update TestRunner.java
dinsahu 1d82aea
Update TestRunner.java
dinsahu 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
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 |
|---|---|---|
| @@ -1,9 +1,7 @@ | ||
| package net.authorize.sample; | ||
|
|
||
| import java.io.BufferedReader; | ||
| import java.io.IOException; | ||
| import java.io.InputStreamReader; | ||
|
|
||
| import net.authorize.sample.VisaCheckout.*; | ||
| import net.authorize.sample.PaymentTransactions.*; | ||
| import net.authorize.sample.PayPalExpressCheckout.*; | ||
|
|
@@ -18,30 +16,30 @@ | |
| */ | ||
| public class SampleCode { | ||
|
|
||
| public static void main( String[] args ) | ||
| public static void main( String[] args ) | ||
| { | ||
|
|
||
| if (args.length == 0) | ||
| { | ||
| SelectMethod(); | ||
| } | ||
| else if (args.length == 1) | ||
| { | ||
| RunMethod(args[0]); | ||
| return; | ||
| } | ||
| else | ||
| { | ||
| ShowUsage(); | ||
| } | ||
| if (args.length == 0) | ||
| { | ||
| SelectMethod(); | ||
| } | ||
| else if (args.length == 1) | ||
| { | ||
| RunMethod(args[0]); | ||
| return; | ||
| } | ||
| else | ||
| { | ||
| ShowUsage(); | ||
| } | ||
|
|
||
| System.out.println(""); | ||
| System.out.print("Press <Return> to finish ..."); | ||
| BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); | ||
| try{ | ||
| int i = Integer.parseInt(br.readLine()); | ||
| }catch(Exception ex) { | ||
| } | ||
| System.out.println(""); | ||
| System.out.print("Press <Return> to finish ..."); | ||
| BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); | ||
| try{ | ||
| int i = Integer.parseInt(br.readLine()); | ||
| }catch(Exception ex) { | ||
| } | ||
|
|
||
| } | ||
|
|
||
|
|
@@ -53,8 +51,6 @@ private static void ShowUsage() | |
| System.out.println(""); | ||
| System.out.println("Code Sample Names: "); | ||
| ShowMethods(); | ||
|
|
||
|
|
||
| } | ||
|
|
||
| private static void SelectMethod() | ||
|
|
@@ -97,6 +93,7 @@ private static void ShowMethods() | |
| System.out.println(" CancelSubscription"); | ||
| System.out.println(" UpdateSubscription"); | ||
| System.out.println(" GetListOfSubscriptions"); | ||
| System.out.println(" GetAccountUpdaterJobDetails"); | ||
| System.out.println(" GetBatchStatistics"); | ||
| System.out.println(" GetSettledBatchList"); | ||
| System.out.println(" GetTransactionList"); | ||
|
|
@@ -138,15 +135,14 @@ private static void RunMethod(String methodName) | |
| { | ||
| // These are default transaction keys. | ||
| // You can create your own keys in seconds by signing up for a sandbox account here: https://developer.authorize.net/sandbox/ | ||
| String apiLoginId = "5KP3u95bQpv"; | ||
| String apiLoginId = "5KP3u95bQpv"; | ||
| String transactionKey = "346HZ32z3fP4hTG2"; | ||
| //Update the payedId with which you want to run the sample code | ||
| String payerId = "6ZSCSYG33VP8Q"; | ||
| //Update the transactionId with which you want to run the sample code | ||
| String transactionId = "123456"; | ||
|
|
||
| String customerProfileId = "37905546"; | ||
| String customerPaymentProfileId = "34461178"; | ||
| String customerProfileId = "40204235"; | ||
| String customerPaymentProfileId = "1000041617"; | ||
| String customerAddressId = "1871959249"; | ||
|
|
||
| String emailId = "[email protected]"; | ||
|
|
@@ -156,14 +152,13 @@ private static void RunMethod(String methodName) | |
| Double amount = 123.45; | ||
|
|
||
| // Proxy server settings. | ||
| // Enable these lines for using Sample Codes behind a proxy server | ||
|
|
||
| // Enable these lines for using Sample Codes behind a proxy server | ||
| // System.setProperty("https.proxyUse", "true"); | ||
| // System.setProperty("https.proxyHost", "example.proxy.server"); | ||
| // System.setProperty("https.proxyPort", "portNumber"); | ||
| // System.setProperty("https.proxyUserName", "exampleUsername"); | ||
| // System.setProperty("https.proxyPassword", "examplePassword"); | ||
|
|
||
| switch (methodName) { | ||
| case "DecryptVisaCheckoutData": | ||
| DecryptVisaCheckoutData.run(apiLoginId, transactionKey); | ||
|
|
@@ -342,9 +337,13 @@ private static void RunMethod(String methodName) | |
| case "GetAnAcceptPaymentPage": | ||
| GetAnAcceptPaymentPage.run(apiLoginId, transactionKey, amount); | ||
| break; | ||
| case "GetAccountUpdaterJobDetails": | ||
| GetAccountUpdaterJobDetails.run(apiLoginId, transactionKey); | ||
| break; | ||
| default: | ||
| ShowUsage(); | ||
| break; | ||
| } | ||
|
|
||
| } | ||
| } | ||
154 changes: 154 additions & 0 deletions
154
src/main/java/net/authorize/sample/TransactionReporting/GetAccountUpdaterJobDetails.java
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,154 @@ | ||
| package net.authorize.sample.TransactionReporting; | ||
|
|
||
| import java.util.ArrayList; | ||
| import net.authorize.Environment; | ||
| import net.authorize.api.contract.v1.ANetApiResponse; | ||
| import net.authorize.api.contract.v1.AUJobTypeEnum; | ||
| import net.authorize.api.contract.v1.AuDeleteType; | ||
| import net.authorize.api.contract.v1.AuDetailsType; | ||
| import net.authorize.api.contract.v1.AuUpdateType; | ||
| import net.authorize.api.contract.v1.CreditCardMaskedType; | ||
| import net.authorize.api.contract.v1.GetAUJobDetailsRequest; | ||
| import net.authorize.api.contract.v1.GetAUJobDetailsResponse; | ||
| import net.authorize.api.contract.v1.MerchantAuthenticationType; | ||
| import net.authorize.api.contract.v1.MessageTypeEnum; | ||
| import net.authorize.api.contract.v1.Paging; | ||
| import net.authorize.api.controller.GetAUJobDetailsController; | ||
| import net.authorize.api.controller.base.ApiOperationBase; | ||
|
|
||
| public class GetAccountUpdaterJobDetails { | ||
|
|
||
| public static ANetApiResponse run(String apiLoginId, String transactionKey) { | ||
|
|
||
| // Set the request to operate in either the sandbox or production environment | ||
| ApiOperationBase.setEnvironment(Environment.SANDBOX); | ||
|
|
||
| // Create object with merchant authentication details | ||
| MerchantAuthenticationType merchantAuthenticationType = new MerchantAuthenticationType(); | ||
| merchantAuthenticationType.setName(apiLoginId); | ||
| merchantAuthenticationType.setTransactionKey(transactionKey); | ||
|
|
||
| String month = "2018-08"; | ||
| String reFid = "123456"; | ||
| Paging paging = new Paging(); | ||
| paging.setLimit(100); | ||
| paging.setOffset(2); | ||
|
|
||
|
|
||
| // Create the API request and set the parameters for this specific request | ||
| GetAUJobDetailsRequest apiRequest = new GetAUJobDetailsRequest(); | ||
| apiRequest.setMerchantAuthentication(merchantAuthenticationType); | ||
| apiRequest.setPaging(paging); | ||
| apiRequest.setRefId(reFid); | ||
| apiRequest.setMonth(month); | ||
| apiRequest.setModifiedTypeFilter(AUJobTypeEnum.ALL); | ||
|
|
||
| // Call the controller | ||
| GetAUJobDetailsController controller = new GetAUJobDetailsController(apiRequest); | ||
| controller.execute(); | ||
|
|
||
| GetAUJobDetailsResponse response = new GetAUJobDetailsResponse(); | ||
| response = controller.getApiResponse(); | ||
|
|
||
| // If API Response is OK, go ahead and check the transaction response | ||
| if (response != null && response.getMessages().getResultCode() == MessageTypeEnum.OK) { | ||
|
|
||
| System.out.println("SUCCESS: Get Account Updater job details for Month: " + month); | ||
|
|
||
| if (response.getAuDetails() == null) { | ||
| System.out.println("No GetAccountUpdaterjobdetails for Month."); | ||
| return response; | ||
| } | ||
|
|
||
| ArrayList<AuUpdateType> updateTypeList = new ArrayList<AuUpdateType>(); | ||
| ArrayList<AuDeleteType> deleteTypeList = new ArrayList<AuDeleteType>(); | ||
|
|
||
| for (AuDetailsType details : response.getAuDetails().getAuUpdateOrAuDelete()) { | ||
|
|
||
| System.out.println("---Customer Profile Details Start---"); | ||
| System.out.println("Profile ID:" + details.getCustomerProfileID()); | ||
| System.out.println("Payment Profile ID:" + details.getCustomerPaymentProfileID()); | ||
| System.out.println("First Name:" + details.getFirstName()); | ||
| System.out.println("Last Name:" + details.getLastName()); | ||
| System.out.println("Update Time UTC:" + details.getUpdateTimeUTC()); | ||
| System.out.println("Reason Code:" + details.getAuReasonCode()); | ||
| System.out.println("Reason Description:" + details.getReasonDescription()); | ||
|
|
||
| if (details.getClass().getTypeName().toString().contains("AuUpdateType")) { | ||
|
|
||
| updateTypeList.add((AuUpdateType) details); | ||
|
|
||
| } else if (details.getClass().getTypeName().toString().contains("AuDeleteType")) { | ||
gnongsie marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| deleteTypeList.add((AuDeleteType) details); | ||
|
|
||
| } | ||
|
|
||
| if (!(updateTypeList.isEmpty())) { | ||
| for (int i = 0; i < updateTypeList.size(); i++) { | ||
|
|
||
| System.out.println("---AU Update Start---"); | ||
| System.out.println("Profile ID:" + details.getCustomerProfileID()); | ||
| System.out.println("Payment Profile ID:" + details.getCustomerPaymentProfileID()); | ||
| System.out.println("First Name:" + details.getFirstName()); | ||
| System.out.println("Last Name:" + details.getLastName()); | ||
| System.out.println("Update Time UTC:" + details.getUpdateTimeUTC()); | ||
| System.out.println("Reason Code:" + details.getAuReasonCode()); | ||
| System.out.println("Reason Description:" + details.getReasonDescription()); | ||
|
|
||
| if (updateTypeList.get(i).getNewCreditCard() != null) { | ||
| CreditCardMaskedType newCreditCard = updateTypeList.get(i).getNewCreditCard(); | ||
| System.out.println("---Fetching New Card Details---"); | ||
| System.out.println("Card Number:" + newCreditCard.getCardNumber()); | ||
| System.out.println("Expiration Date:" + newCreditCard.getExpirationDate()); | ||
| System.out.println("Card Type:" + newCreditCard.getCardType()); | ||
| } | ||
|
|
||
| if (updateTypeList.get(i).getOldCreditCard() != null) { | ||
| CreditCardMaskedType oldCreditCard = updateTypeList.get(i).getOldCreditCard(); | ||
| System.out.println("---Fetching Old Card Details---"); | ||
| System.out.println("Card Number:" + oldCreditCard.getCardNumber()); | ||
| System.out.println("Expiration Date:" + oldCreditCard.getExpirationDate()); | ||
| System.out.println("Card Type:" + oldCreditCard.getCardType()); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (!(deleteTypeList.isEmpty())) { | ||
| for (int i = 0; i < deleteTypeList.size(); i++) { | ||
|
|
||
| System.out.println("---AU Delete Start---"); | ||
| System.out.println("Profile ID:" + details.getCustomerProfileID()); | ||
| System.out.println("Payment Profile ID:" + details.getCustomerPaymentProfileID()); | ||
| System.out.println("First Name:" + details.getFirstName()); | ||
| System.out.println("Last Name:" + details.getLastName()); | ||
| System.out.println("Update Time UTC:" + details.getUpdateTimeUTC()); | ||
| System.out.println("Reason Code:" + details.getAuReasonCode()); | ||
| System.out.println("Reason Description:" + details.getReasonDescription()); | ||
|
|
||
| if (deleteTypeList.get(i).getCreditCard() != null) { | ||
|
|
||
| CreditCardMaskedType creditCard = deleteTypeList.get(i).getCreditCard(); | ||
| System.out.println("Card Number:" + creditCard.getCardNumber()); | ||
| System.out.println("Expiration Date:" + creditCard.getExpirationDate()); | ||
| System.out.println("Card Type:" + creditCard.getCardType()); | ||
| } | ||
|
|
||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| else { | ||
| // Display the error code and message when response is null | ||
| ANetApiResponse errorResponse = controller.getErrorResponse(); | ||
| System.out.println("Failed to get response"); | ||
| if (!errorResponse.getMessages().getMessage().isEmpty()) { | ||
| System.out.println("Error: " + errorResponse.getMessages().getMessage().get(0).getCode() + " \n" | ||
| + errorResponse.getMessages().getMessage().get(0).getText()); | ||
| } | ||
| } | ||
|
|
||
| return response; | ||
| } | ||
| } | ||
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
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.