Skip to content
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

PR1992#Sample-code-csharp GetAccountUpdaterJobDetails changes #86

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
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
8 changes: 6 additions & 2 deletions SampleCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,15 @@ private static void ShowMethods()
Console.WriteLine(" GetAnAcceptPaymentPage");
Console.WriteLine(" GetCustomerProfileTransactionList");
Console.WriteLine(" GetAccountUpdaterJobSummary");
Console.WriteLine(" GetAccountUpdaterJobDetails");
}

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/
const string apiLoginId = "5KP3u95bQpv";
const string transactionKey = "346HZ32z3fP4hTG2";
const string apiLoginId = "mbld_api_-Bgb1Oig";
kapilkumar99 marked this conversation as resolved.
Show resolved Hide resolved
const string transactionKey = "123abc";

//Update TransactionID for which you want to run the sample code
const string transactionId = "2249735976";
Expand Down Expand Up @@ -335,6 +336,9 @@ private static void RunMethod(String methodName)
//case "GetAccountUpdaterJobSummary":
// GetAccountUpdaterJobSummary.Run(apiLoginId, transactionKey);
// break;
case "GetAccountUpdaterJobDetails":
GetAccountUpdaterJobDetails.Run(apiLoginId, transactionKey);
break;
default:
ShowUsage();
break;
Expand Down
1 change: 1 addition & 0 deletions SampleCode.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
<Compile Include="RecurringBilling\GetSubscriptionStatus.cs" />
<Compile Include="RecurringBilling\UpdateSubscription.cs" />
<Compile Include="SampleCode.cs" />
<Compile Include="TransactionReporting\GetAccountUpdaterJobDetails.cs" />
<Compile Include="TransactionReporting\GetBatchStatistics.cs" />
<Compile Include="TransactionReporting\GetMerchantDetails.cs" />
<Compile Include="TransactionReporting\GetSettledBatchList.cs" />
Expand Down
4 changes: 4 additions & 0 deletions SampleCodeTest/TestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -435,5 +435,9 @@ public ANetApiResponse TestGetAnAcceptPaymentPage()
//{
// return GetAccountUpdaterJobSummary.Run(apiLoginId, transactionKey);
//}
public ANetApiResponse TestGetAccountUpdaterJobDetails()
{
return GetAccountUpdaterJobDetails.Run(apiLoginId, transactionKey);
}
}
}
91 changes: 71 additions & 20 deletions TransactionReporting/GetAccountUpdaterJobDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using AuthorizeNet.Api.Contracts.V1;
using AuthorizeNet.Api.Controllers;
using AuthorizeNet.Api.Controllers.Bases;
using System.Collections;

namespace net.authorize.sample
{
Expand All @@ -25,52 +26,102 @@ public static ANetApiResponse Run(String ApiLoginID, String ApiTransactionKey)
};

// parameters for request
string month = "2017-06";
string modifiedTypeFilter = "all"
string month = "2018-08"; //"2017-06";
kapilkumar99 marked this conversation as resolved.
Show resolved Hide resolved
string modifiedTypeFilter = "all";

var request = new getAccountUpdaterJobDetailsRequest();
var request = new getAUJobDetailsRequest();
request.month = month;
request.modifiedTypeFilter = modifiedTypeFilter;
request.modifiedTypeFilter = AUJobTypeEnum.all;
request.paging = new Paging
{
limit = 1000,
limit = 100,
offset = 1
};

// instantiate the controller that will call the service
var controller = new getAccountUpdaterJobDetailsController(request);
var controller = new getAUJobDetailsController(request);
controller.Execute();

// get the response from the service (errors contained if any)
var response = controller.GetApiResponse();

if (response != null && response.messages.resultCode == messageTypeEnum.Ok)
{
Console.WriteLine("SUCCESS: Get Account Updater job details for Month and year : " + month);
kapilkumar99 marked this conversation as resolved.
Show resolved Hide resolved
if (response.auDetails == null)
return response;

foreach (var update in response.auDetails.auUpdate)
{
Console.WriteLine("Profile ID / Payment Profile ID: {0} / {1}", update.customerProfileID, update.customerPaymentProfileID);
Console.WriteLine("Update Time (UTC): {0}", update.updateTimeUTC);
Console.WriteLine("Reason Code: {0}", update.auReasonCode);
Console.WriteLine("Reason Description: {0}", update.reasonDescription);
Console.WriteLine("No GetAccountUpdaterjobdetails for this month and year.");
kapilkumar99 marked this conversation as resolved.
Show resolved Hide resolved
return response;
}

foreach (var delete in response.auDetails.auDelete)
// Displaying the Audetails of each response in the list
foreach (var details in response.auDetails)
{
Console.WriteLine("Profile ID / Payment Profile ID: {0} / {1}", delete.customerProfileID, update.customerPaymentProfileID);
Console.WriteLine("Update Time (UTC): {0}", delete.updateTimeUTC);
Console.WriteLine("Reason Code: {0}", delete.auReasonCode);
Console.WriteLine("Reason Description: {0}", delete.reasonDescription);


Console.WriteLine(" **** Customer profile details Start ****");
Console.WriteLine("Profile ID / Payment Profile ID: {0} / {1}", details.customerProfileID, details.customerPaymentProfileID);
Console.WriteLine("Firstname lastname : {0} / {1}", details.firstName, details.lastName);
kapilkumar99 marked this conversation as resolved.
Show resolved Hide resolved
Console.WriteLine("Update Time (UTC): {0}", details.updateTimeUTC);
Console.WriteLine("Reason Code: {0}", details.auReasonCode);
Console.WriteLine("Reason Description: {0}", details.reasonDescription);


if (details is auUpdateType)
{
for (int i = 0; i < ((auUpdateType)details).subscriptionIdList.Length; i++)
{
Console.WriteLine("SubscriptionIdList: {0}", ((auUpdateType)details).subscriptionIdList[i]);
}
}
else if (details is auDeleteType)
{
for (int i = 0; i < ((auDeleteType)details).subscriptionIdList.Length; i++)
{
Console.WriteLine("SubscriptionIdList: {0}", ((auDeleteType)details).subscriptionIdList[i]);
}
}


if (details.GetType().GetField("newCreditCard") != null)
{
Console.WriteLine("Fetching New Card Details");
// Fetching New Card Details
var newCreditCard = details.GetType().GetField("newCreditCard").GetValue(details);
creditCardMaskedType newCreditCardMaskedType = (creditCardMaskedType)newCreditCard;
Console.WriteLine("Card Number: {0}", newCreditCardMaskedType.cardNumber);
Console.WriteLine("New Expiration Date: {0}", newCreditCardMaskedType.expirationDate);
Console.WriteLine("New Card Type: {0}", newCreditCardMaskedType.cardType);

}

if (details.GetType().GetField("oldCreditCard") != null)
{
Console.WriteLine("Fetching Old Card Details");
// Fetching Old Card Details
var oldCreditCard = details.GetType().GetField("oldCreditCard").GetValue(details);
creditCardMaskedType oldCreditCardMaskedType = (creditCardMaskedType)oldCreditCard;
Console.WriteLine("Old Card Number: {0}", oldCreditCardMaskedType.cardNumber);
Console.WriteLine("Old Expiration Date: {0}", oldCreditCardMaskedType.expirationDate);
Console.WriteLine("Old Card Type: {0}", oldCreditCardMaskedType.cardType);

Console.WriteLine("**** Customer profile details End ****");
}
}

}

else if (response != null)
{
Console.WriteLine("Error: " + response.messages.message[0].code + " " +
response.messages.message[0].text);
response.messages.message[0].text);
}
else if (response == null)
{
var errResponse = controller.GetErrorResponse();
Console.WriteLine("Error: " + errResponse.messages.message[0].code + " " +
response.messages.message[0].text);
}

return response;
}
}
Expand Down