-
Notifications
You must be signed in to change notification settings - Fork 133
Expand file tree
/
Copy pathGetAccountUpdaterJobDetails.cs
More file actions
86 lines (74 loc) · 3.5 KB
/
GetAccountUpdaterJobDetails.cs
File metadata and controls
86 lines (74 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AuthorizeNet.Api.Contracts.V1;
using AuthorizeNet.Api.Controllers;
using AuthorizeNet.Api.Controllers.Bases;
using System.Collections;
namespace net.authorize.sample
{
public class GetAccountUpdaterJobDetails
{
public static ANetApiResponse Run(String ApiLoginID, String ApiTransactionKey)
{
Console.WriteLine("Get Account Updater job details sample");
ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX;
// define the merchant information (authentication / transaction id)
ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
{
name = ApiLoginID,
ItemElementName = ItemChoiceType.transactionKey,
Item = ApiTransactionKey,
};
// parameters for request
string month = "2018-05";
var request = new getAUJobDetailsRequest();
request.month = month;
request.modifiedTypeFilter = AUJobTypeEnum.all;
request.paging = new Paging
{
limit = 100,
offset = 1
};
// instantiate the controller that will call the service
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 : " + month);
if (response.auDetails == null)
return response;
foreach (var update in response.auDetails)
{
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);
}
foreach (var delete in response.auDetails)
{
Console.WriteLine("Profile ID / Payment Profile ID: {0} / {1}", delete.customerProfileID, delete.customerPaymentProfileID);
Console.WriteLine("Update Time (UTC): {0}", delete.updateTimeUTC);
Console.WriteLine("Reason Code: {0}", delete.auReasonCode);
Console.WriteLine("Reason Description: {0}", delete.reasonDescription);
}
}
else if (response != null)
{
Console.WriteLine("Error: " + response.messages.message[0].code + " " +
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;
}
}
}