6
6
using System . Text ;
7
7
using System . Threading . Tasks ;
8
8
using net . authorize . sample . CustomerProfiles ;
9
+ using AuthorizeNet . Api . Controllers . Bases ;
10
+ using AuthorizeNet . Api . Contracts . V1 ;
11
+ #if NETCOREAPP2_0
12
+ using AuthorizeNet . Utilities ;
13
+ #endif
9
14
10
15
namespace net . authorize . sample
11
16
{
@@ -38,7 +43,7 @@ static void Main(string[] args)
38
43
Console . WriteLine ( "" ) ;
39
44
Console . Write ( "Press <Return> to finish ..." ) ;
40
45
Console . ReadLine ( ) ;
41
-
46
+
42
47
}
43
48
44
49
private static void ShowUsage ( )
@@ -65,7 +70,7 @@ private static void SelectMethod()
65
70
66
71
private static void ShowMethods ( )
67
72
{
68
-
73
+
69
74
Console . WriteLine ( " ChargeCreditCard" ) ;
70
75
Console . WriteLine ( " AuthorizeCreditCard" ) ;
71
76
Console . WriteLine ( " CapturePreviouslyAuthorizedAmount" ) ;
@@ -146,14 +151,34 @@ private static void RunMethod(String methodName)
146
151
//Update PayerID for which you want to run the sample code
147
152
const string payerId = "M8R9JRNJ3R28Y" ;
148
153
149
- const string customerProfileId = "213213" ;
150
- const string customerPaymentProfileId = "2132345" ;
154
+ const string customerProfileId = "1915435550" ; //"213213";
155
+ const string customerPaymentProfileId = "1828811149" ; //"2132345";
156
+
151
157
const string shippingAddressId = "1223213" ;
152
158
const decimal amount = 12.34m ;
153
159
const string subscriptionId = "1223213" ;
154
160
const short day = 45 ;
155
161
const string emailId = "[email protected] " ;
156
162
163
+ #if NETCOREAPP2_0
164
+ // DOTNET CORE SPECIFIC
165
+ #region DOTNET CORE SPECIFIC
166
+
167
+ ApiOperationBase < ANetApiRequest , ANetApiResponse > . RunEnvironment = AuthorizeNet . Environment . SANDBOX ;
168
+ ApiOperationBase < ANetApiRequest , ANetApiResponse > . RunEnvironment . HttpUseProxy = AuthorizeNet . Environment . getBooleanProperty ( Constants . HttpsUseProxy ) ;
169
+
170
+ if ( ApiOperationBase < ANetApiRequest , ANetApiResponse > . RunEnvironment . HttpUseProxy )
171
+ {
172
+ ApiOperationBase < ANetApiRequest , ANetApiResponse > . RunEnvironment . HttpUseProxy = AuthorizeNet . Environment . getBooleanProperty ( Constants . HttpsUseProxy ) ;
173
+ ApiOperationBase < ANetApiRequest , ANetApiResponse > . RunEnvironment . HttpsProxyUsername = AuthorizeNet . Environment . GetProperty ( Constants . HttpsProxyUsername ) ;
174
+ ApiOperationBase < ANetApiRequest , ANetApiResponse > . RunEnvironment . HttpsProxyPassword = AuthorizeNet . Environment . GetProperty ( Constants . HttpsProxyPassword ) ;
175
+ ApiOperationBase < ANetApiRequest , ANetApiResponse > . RunEnvironment . HttpProxyHost = AuthorizeNet . Environment . GetProperty ( Constants . HttpsProxyHost ) ;
176
+ ApiOperationBase < ANetApiRequest , ANetApiResponse > . RunEnvironment . HttpProxyPort = AuthorizeNet . Environment . getIntProperty ( Constants . HttpsProxyPort ) ;
177
+ }
178
+
179
+ #endregion
180
+ #endif
181
+
157
182
switch ( methodName )
158
183
{
159
184
case "ValidateCustomerPaymentProfile" :
@@ -264,7 +289,7 @@ private static void RunMethod(String methodName)
264
289
case "PayPalAuthorizeCapture" :
265
290
PayPalAuthorizeCapture . Run ( apiLoginId , transactionKey , amount ) ;
266
291
break ;
267
- case "PayPalAuthorizeCaptureContinued" :
292
+ case "PayPalAuthorizeCaptureContinued" :
268
293
PayPalAuthorizeCaptureContinued . Run ( apiLoginId , transactionKey , transactionId , payerId ) ;
269
294
break ;
270
295
case "PayPalAuthorizeOnly" :
@@ -289,7 +314,7 @@ private static void RunMethod(String methodName)
289
314
CreateSubscription . Run ( apiLoginId , transactionKey , day ) ;
290
315
break ;
291
316
case "CreateSubscriptionFromCustomerProfile" :
292
- CreateSubscriptionFromCustomerProfile . Run ( apiLoginId , transactionKey , day , "12322" , "232321" , "123232" ) ;
317
+ CreateSubscriptionFromCustomerProfile . Run ( apiLoginId , transactionKey , day , "12322" , "232321" , "123232" ) ;
293
318
break ;
294
319
case "GetListOfSubscriptions" :
295
320
GetListOfSubscriptions . Run ( apiLoginId , transactionKey ) ;
@@ -316,29 +341,23 @@ private static void RunMethod(String methodName)
316
341
GetBatchStatistics . Run ( apiLoginId , transactionKey ) ;
317
342
break ;
318
343
case "GetSettledBatchList" :
319
- GetSettledBatchList . Run ( apiLoginId , transactionKey ) ;
320
- break ;
344
+ GetSettledBatchList . Run ( apiLoginId , transactionKey ) ;
345
+ break ;
321
346
case "UpdateSplitTenderGroup" :
322
- UpdateSplitTenderGroup . Run ( apiLoginId , transactionKey ) ;
323
- break ;
347
+ UpdateSplitTenderGroup . Run ( apiLoginId , transactionKey ) ;
348
+ break ;
324
349
case "GetHeldTransactionList" :
325
350
GetHeldTransactionList . Run ( apiLoginId , transactionKey ) ;
326
351
break ;
327
352
case "ApproveOrDeclineHeldTransaction" :
328
353
ApproveOrDeclineHeldTransaction . Run ( apiLoginId , transactionKey ) ;
329
354
break ;
330
355
case "GetMerchantDetails" :
331
- GetMerchantDetails . Run ( apiLoginId , transactionKey ) ;
332
- break ;
356
+ GetMerchantDetails . Run ( apiLoginId , transactionKey ) ;
357
+ break ;
333
358
case "GetAnAcceptPaymentPage" :
334
359
GetAnAcceptPaymentPage . Run ( apiLoginId , transactionKey , 12.23m ) ;
335
360
break ;
336
- case "GetCustomerProfileTransactionList" :
337
- GetCustomerProfileTransactionList . Run ( apiLoginId , transactionKey , customerProfileId ) ;
338
- break ;
339
- //case "GetAccountUpdaterJobSummary":
340
- // GetAccountUpdaterJobSummary.Run(apiLoginId, transactionKey);
341
- // break;
342
361
default :
343
362
ShowUsage ( ) ;
344
363
break ;
0 commit comments