-
Notifications
You must be signed in to change notification settings - Fork 133
/
Copy pathGetHeldTransactionList.cs
67 lines (61 loc) · 2.46 KB
/
GetHeldTransactionList.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AuthorizeNet;
using AuthorizeNet.Api.Controllers;
using AuthorizeNet.Api.Contracts.V1;
using AuthorizeNet.Api.Controllers.Bases;
namespace net.authorize.sample
{
public class GetHeldTransactionList
{
public static ANetApiResponse Run(String ApiLoginID, String ApiTransactionKey)
{
Console.WriteLine("Get suspicious transaction list 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,
};
var request = new getUnsettledTransactionListRequest();
request.status = TransactionGroupStatusEnum.pendingApproval;
request.statusSpecified = true;
request.paging = new Paging
{
limit = 10,
offset = 1
};
request.sorting = new TransactionListSorting
{
orderBy = TransactionListOrderFieldEnum.id,
orderDescending = true
};
// instantiate the controller that will call the service
var controller = new getUnsettledTransactionListController(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)
{
if (response.transactions == null)
return response;
foreach (var item in response.transactions)
{
Console.WriteLine("Transaction Id: {0} was submitted on {1}", item.transId,
item.submitTimeLocal);
}
}
else if(response != null)
{
Console.WriteLine("Error: " + response.messages.message[0].code + " " +
response.messages.message[0].text);
}
return response;
}
}
}