forked from AuthorizeNet/sample-code-csharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SampleCode.cs
88 lines (77 loc) · 2.51 KB
/
SampleCode.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace net.authorize.sample
{
//===============================================================================================
//
// NOTE: If you add a new sample update the following methods here:
//
// ShowMethods() - Add the method name
// RunMethod(String methodName) - Update the switch statement to run the method
//
//===============================================================================================
class SampleCode
{
static void Main(string[] args)
{
if (args.Length == 0)
{
SelectMethod();
}
else if (args.Length == 1)
{
RunMethod(args[0]);
return;
}
else
{
ShowUsage();
}
Console.WriteLine("");
Console.Write("Press <Return> to finish ...");
Console.ReadLine();
}
private static void ShowUsage()
{
Console.WriteLine("Usage : SampleCode [CodeSampleName]");
Console.WriteLine("");
Console.WriteLine("Run with no parameter to select a method. Otherwise pass a method name.");
Console.WriteLine("");
Console.WriteLine("Code Sample Names: ");
ShowMethods();
Console.WriteLine("Code Sample Names: ");
}
private static void SelectMethod()
{
Console.WriteLine("Code Sample Names: ");
Console.WriteLine("");
ShowMethods();
Console.WriteLine("");
Console.Write("Type a sample name & then press <Return> : ");
RunMethod(Console.ReadLine());
}
private static void ShowMethods()
{
Console.WriteLine(" VisaCheckoutDecrypt");
Console.WriteLine(" VisaCheckoutTransaction");
}
private static void RunMethod(String methodName)
{
switch (methodName)
{
case "VisaCheckoutDecrypt":
VisaCheckoutDecrypt.Run();
break;
case "VisaCheckoutTransaction":
VisaCheckoutTransaction.Run();
break;
default:
ShowUsage();
break;
}
}
}
}