Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions src/main/java/net/authorize/sample/SampleCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
public class SampleCode {

public static void main( String[] args )
public static void main( String[] args ) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException
Comment thread
gnongsie marked this conversation as resolved.
Outdated
{

if (args.length == 0)
Expand Down Expand Up @@ -97,6 +97,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");
Expand Down Expand Up @@ -134,19 +135,20 @@ private static void ShowMethods()
System.out.println(" GetAnAcceptPaymentPage");
}

private static void RunMethod(String methodName)
private static void RunMethod(String methodName) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException
Comment thread
gnongsie marked this conversation as resolved.
Outdated
{
// 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 transactionKey = "346HZ32z3fP4hTG2";
String apiLoginId = "mbld_api_%63ty4Rq";

String transactionKey = "123abc";
Comment thread
gnongsie marked this conversation as resolved.
Outdated
//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 = "test@test.com";
Expand All @@ -163,7 +165,8 @@ private static void RunMethod(String methodName)
// System.setProperty("https.proxyPort", "portNumber");
// System.setProperty("https.proxyUserName", "exampleUsername");
// System.setProperty("https.proxyPassword", "examplePassword");



Comment thread
gnongsie marked this conversation as resolved.
Outdated
switch (methodName) {
case "DecryptVisaCheckoutData":
DecryptVisaCheckoutData.run(apiLoginId, transactionKey);
Expand Down Expand Up @@ -342,6 +345,10 @@ private static void RunMethod(String methodName)
case "GetAnAcceptPaymentPage":
GetAnAcceptPaymentPage.run(apiLoginId, transactionKey, amount);
break;
case "GetAccountUpdaterJobDetails":
GetAccountUpdaterJobDetails.run(apiLoginId, transactionKey);
break;

default:
ShowUsage();
break;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
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)
throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException {
Comment thread
gnongsie marked this conversation as resolved.
Outdated

// 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 and year : " + month);
Comment thread
gnongsie marked this conversation as resolved.
Outdated

if (response.getAuDetails() == null) {
System.out.println("No GetAccountUpdaterjobdetails for this month and year.");
Comment thread
gnongsie marked this conversation as resolved.
Outdated
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("customerProfileID:" + details.getCustomerProfileID());
System.out.println("customerPaymentProfileID:" + details.getCustomerPaymentProfileID());
System.out.println("customerFirstname:" + details.getFirstName());
System.out.println("customerLastname:" + details.getLastName());
System.out.println("updateTimeUTC:" + details.getUpdateTimeUTC());
System.out.println("reasonCode:" + details.getAuReasonCode());
System.out.println("reasonDescription:" + details.getReasonDescription());
Comment thread
gnongsie marked this conversation as resolved.
Outdated

if (details.getClass().getTypeName().toString().contains("AuUpdateType")) {

updateTypeList.add((AuUpdateType) details);

} else if (details.getClass().getTypeName().toString().contains("AuDeleteType")) {

deleteTypeList.add((AuDeleteType) details);

}

if (!(updateTypeList.isEmpty())) {
for (int i = 0; i < updateTypeList.size(); i++) {

System.out.println("---AU Update Start---");
System.out.println("customerProfileID:" + details.getCustomerProfileID());
System.out.println("customerPaymentProfileID:" + details.getCustomerPaymentProfileID());
System.out.println("customerFirstname:" + details.getFirstName());
System.out.println("customerLastname:" + details.getLastName());
System.out.println("updateTimeUTC:" + details.getUpdateTimeUTC());
System.out.println("reasonCode:" + details.getAuReasonCode());
System.out.println("reasonDescription:" + details.getReasonDescription());
Comment thread
gnongsie marked this conversation as resolved.
Outdated

if ((updateTypeList.get(i).getSubscriptionIdList() != null)
&& (updateTypeList.get(i).getSubscriptionIdList().getSubscriptionId() != null)
&& (!updateTypeList.get(i).getSubscriptionIdList().getSubscriptionId().isEmpty())) {
System.out.println("SubscriptionIdlist");
for (String subscriptionid : updateTypeList.get(i).getSubscriptionIdList()
.getSubscriptionId())
System.out.println("SubscriptionId:" + subscriptionid);

}

if (updateTypeList.get(i).getNewCreditCard() != null) {
CreditCardMaskedType newCreditCard = updateTypeList.get(i).getNewCreditCard();
System.out.println("---Fetching New Card Details---");
System.out.println("cardNumber:" + newCreditCard.getCardNumber());
System.out.println("expirationDate:" + newCreditCard.getExpirationDate());
System.out.println("cardType:" + newCreditCard.getCardType());
Comment thread
gnongsie marked this conversation as resolved.
Outdated

}

if (updateTypeList.get(i).getOldCreditCard() != null) {
CreditCardMaskedType oldCreditCard = updateTypeList.get(i).getOldCreditCard();
System.out.println("---Fetching Old Card Details---");
System.out.println("cardNumber:" + oldCreditCard.getCardNumber());
System.out.println("expirationDate:" + oldCreditCard.getExpirationDate());
System.out.println("cardType:" + oldCreditCard.getCardType());
Comment thread
gnongsie marked this conversation as resolved.
Outdated

}
}
}

if (!(deleteTypeList.isEmpty())) {
for (int i = 0; i < deleteTypeList.size(); i++) {

System.out.println("---AU Delete Start---");
System.out.println("customerProfileID:" + details.getCustomerProfileID());
System.out.println("customerPaymentProfileID:" + details.getCustomerPaymentProfileID());
System.out.println("customerFirstname:" + details.getFirstName());
System.out.println("customerLastname:" + details.getLastName());
System.out.println("updateTimeUTC:" + details.getUpdateTimeUTC());
System.out.println("reasonCode:" + details.getAuReasonCode());
System.out.println("reasonDescription:" + details.getReasonDescription());
Comment thread
gnongsie marked this conversation as resolved.
Outdated


if ((deleteTypeList.get(i).getSubscriptionIdList() != null)
&& (deleteTypeList.get(i).getSubscriptionIdList().getSubscriptionId() != null)
&& (!deleteTypeList.get(i).getSubscriptionIdList().getSubscriptionId().isEmpty())) {
System.out.println("SubscriptionIdlist");
for (String subscriptionid : deleteTypeList.get(i).getSubscriptionIdList()
.getSubscriptionId())
System.out.println("SubscriptionId:" + subscriptionid);

}

if (deleteTypeList.get(i).getCreditCard() != null) {

CreditCardMaskedType creditCard = deleteTypeList.get(i).getCreditCard();
System.out.println("cardNumber:" + creditCard.getCardNumber());
System.out.println("expirationDate:" + creditCard.getExpirationDate());
System.out.println("cardType:" + creditCard.getCardType());
Comment thread
gnongsie marked this conversation as resolved.
Outdated
}

}
}

}
}

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;
}
}
26 changes: 17 additions & 9 deletions src/test/java/net/authorize/sample/SampleCodeTest/TestRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,21 @@
import net.authorize.sample.CustomerProfiles.DeleteCustomerPaymentProfile;
import net.authorize.sample.CustomerProfiles.DeleteCustomerProfile;
import net.authorize.sample.CustomerProfiles.DeleteCustomerShippingAddress;
import net.authorize.sample.CustomerProfiles.GetAcceptCustomerProfilePage;
import net.authorize.sample.CustomerProfiles.GetCustomerPaymentProfile;
import net.authorize.sample.CustomerProfiles.GetCustomerProfile;
import net.authorize.sample.CustomerProfiles.GetCustomerShippingAddress;
import net.authorize.sample.CustomerProfiles.GetAcceptCustomerProfilePage;
import net.authorize.sample.CustomerProfiles.UpdateCustomerPaymentProfile;
import net.authorize.sample.CustomerProfiles.UpdateCustomerProfile;
import net.authorize.sample.CustomerProfiles.UpdateCustomerShippingAddress;
import net.authorize.sample.CustomerProfiles.ValidateCustomerPaymentProfile;
import net.authorize.sample.PayPalExpressCheckout.AuthorizationAndCapture;
import net.authorize.sample.PayPalExpressCheckout.AuthorizationAndCaptureContinued;
import net.authorize.sample.PayPalExpressCheckout.AuthorizationOnly;
import net.authorize.sample.PayPalExpressCheckout.AuthorizationOnlyContinued;
import net.authorize.sample.PayPalExpressCheckout.Credit;
import net.authorize.sample.PayPalExpressCheckout.GetDetails;
import net.authorize.sample.PayPalExpressCheckout.PriorAuthorizationCapture;
import net.authorize.sample.PaymentTransactions.AuthorizeCreditCard;
import net.authorize.sample.PaymentTransactions.CaptureFundsAuthorizedThroughAnotherChannel;
import net.authorize.sample.PaymentTransactions.CapturePreviouslyAuthorizedAmount;
Expand All @@ -55,23 +62,18 @@
import net.authorize.sample.PaymentTransactions.ChargeTokenizedCreditCard;
import net.authorize.sample.PaymentTransactions.CreditBankAccount;
import net.authorize.sample.PaymentTransactions.DebitBankAccount;
import net.authorize.sample.PaymentTransactions.GetAnAcceptPaymentPage;
import net.authorize.sample.PaymentTransactions.RefundTransaction;
import net.authorize.sample.PaymentTransactions.VoidTransaction;
import net.authorize.sample.PayPalExpressCheckout.AuthorizationAndCapture;
import net.authorize.sample.PayPalExpressCheckout.AuthorizationAndCaptureContinued;
import net.authorize.sample.PayPalExpressCheckout.AuthorizationOnly;
import net.authorize.sample.PayPalExpressCheckout.AuthorizationOnlyContinued;
import net.authorize.sample.PayPalExpressCheckout.Credit;
import net.authorize.sample.PayPalExpressCheckout.GetDetails;
import net.authorize.sample.PayPalExpressCheckout.PriorAuthorizationCapture;
import net.authorize.sample.RecurringBilling.CancelSubscription;
import net.authorize.sample.RecurringBilling.CreateSubscription;
import net.authorize.sample.RecurringBilling.CreateSubscriptionFromCustomerProfile;
import net.authorize.sample.RecurringBilling.GetSubscription;
import net.authorize.sample.RecurringBilling.GetSubscriptionStatus;
import net.authorize.sample.RecurringBilling.UpdateSubscription;
import net.authorize.sample.TransactionReporting.GetAccountUpdaterJobDetails;
import net.authorize.sample.TransactionReporting.GetTransactionDetails;
import net.authorize.sample.PaymentTransactions.GetAnAcceptPaymentPage;


public class TestRunner {

Expand Down Expand Up @@ -539,4 +541,10 @@ public ANetApiResponse TestGetAnAcceptPaymentPage()
{
return GetAnAcceptPaymentPage.run(apiLoginId, transactionKey, getAmount());
}
/*---Added for GetAccountUpdaterJobDetails---*/
public ANetApiResponse TestGetAccountUpdaterJobDetails() throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException
Comment thread
gnongsie marked this conversation as resolved.
Outdated
{
return GetAccountUpdaterJobDetails.run(apiLoginId, transactionKey);
}
/*---End---*/
}