1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Linq ;
4+ using System . Text ;
5+ using System . Threading . Tasks ;
6+ using AuthorizeNet ;
7+ using AuthorizeNet . Api . Controllers ;
8+ using AuthorizeNet . Api . Contracts . V1 ;
9+ using AuthorizeNet . Api . Controllers . Bases ;
10+
11+ namespace net . authorize . sample
12+ {
13+ public class GetHeldTransactionList
14+ {
15+ public static ANetApiResponse Run ( String ApiLoginID , String ApiTransactionKey )
16+ {
17+ Console . WriteLine ( "Get suspicious transaction list sample" ) ;
18+
19+ ApiOperationBase < ANetApiRequest , ANetApiResponse > . RunEnvironment = AuthorizeNet . Environment . SANDBOX ;
20+ // define the merchant information (authentication / transaction id)
21+ ApiOperationBase < ANetApiRequest , ANetApiResponse > . MerchantAuthentication = new merchantAuthenticationType ( )
22+ {
23+ name = ApiLoginID ,
24+ ItemElementName = ItemChoiceType . transactionKey ,
25+ Item = ApiTransactionKey ,
26+ } ;
27+
28+ var request = new getUnsettledTransactionListRequest ( ) ;
29+ request . status = TransactionGroupStatusEnum . pendingApproval ;
30+ request . statusSpecified = true ;
31+ request . paging = new Paging
32+ {
33+ limit = 10 ,
34+ offset = 1
35+ } ;
36+ request . sorting = new TransactionListSorting
37+ {
38+ orderBy = TransactionListOrderFieldEnum . id ,
39+ orderDescending = true
40+ } ;
41+ // instantiate the controller that will call the service
42+ var controller = new getUnsettledTransactionListController ( request ) ;
43+ controller . Execute ( ) ;
44+
45+ // get the response from the service (errors contained if any)
46+ var response = controller . GetApiResponse ( ) ;
47+ if ( response != null && response . messages . resultCode == messageTypeEnum . Ok )
48+ {
49+ if ( response . transactions == null )
50+ return response ;
51+
52+ foreach ( var item in response . transactions )
53+ {
54+ Console . WriteLine ( "Transaction Id: {0} was submitted on {1}" , item . transId ,
55+ item . submitTimeLocal ) ;
56+ }
57+ }
58+ else if ( response != null )
59+ {
60+ Console . WriteLine ( "Error: " + response . messages . message [ 0 ] . code + " " +
61+ response . messages . message [ 0 ] . text ) ;
62+ }
63+
64+ return response ;
65+ }
66+ }
67+ }
0 commit comments