Skip to content

Commit 5fb8f9e

Browse files
committed
Added Visa Checkout Samples
1 parent 917ac49 commit 5fb8f9e

9 files changed

+311
-0
lines changed

App.config

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
5+
</startup>
6+
</configuration>

Properties/AssemblyInfo.cs

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("SampleCode")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("Microsoft")]
12+
[assembly: AssemblyProduct("SampleCode")]
13+
[assembly: AssemblyCopyright("Copyright © Microsoft 2015")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("c6bc047e-67e2-46d4-8df2-8f787b88a871")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

SampleCode.cs

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace net.authorize.sample
8+
{
9+
class SampleCode
10+
{
11+
static void Main(string[] args)
12+
{
13+
if (args.Length != 1)
14+
{
15+
ShowUsage();
16+
return;
17+
}
18+
19+
switch(args[0])
20+
{
21+
case "VisaCheckoutDecrypt" :
22+
VisaCheckoutDecrypt.Run();
23+
break;
24+
case "VisaCheckoutTransaction":
25+
VisaCheckoutTransaction.Run();
26+
break;
27+
default:
28+
ShowUsage();
29+
break;
30+
}
31+
32+
Console.ReadLine();
33+
34+
}
35+
36+
private static void ShowUsage()
37+
{
38+
Console.WriteLine("Usage : SampleCode <CodeSampleName>");
39+
Console.WriteLine("");
40+
Console.WriteLine("Code Sample Names: ");
41+
Console.WriteLine("");
42+
Console.WriteLine(" VisaCheckoutDecrypt");
43+
Console.WriteLine(" VisaCheckoutTransaction");
44+
Console.ReadLine();
45+
}
46+
}
47+
}

SampleCode.csproj

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{EE8CB03C-AFF3-4480-AFD5-1C8B51540570}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>SampleCode</RootNamespace>
11+
<AssemblyName>SampleCode</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<PlatformTarget>AnyCPU</PlatformTarget>
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>.\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<PlatformTarget>AnyCPU</PlatformTarget>
27+
<DebugType>pdbonly</DebugType>
28+
<Optimize>true</Optimize>
29+
<OutputPath>.\</OutputPath>
30+
<DefineConstants>TRACE</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
</PropertyGroup>
34+
<ItemGroup>
35+
<Reference Include="AuthorizeNet, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
36+
<HintPath>packages\AuthorizeNet.1.8.4\lib\AuthorizeNet.dll</HintPath>
37+
<Private>True</Private>
38+
</Reference>
39+
<Reference Include="System" />
40+
<Reference Include="System.Core" />
41+
<Reference Include="System.Xml.Linq" />
42+
<Reference Include="System.Data.DataSetExtensions" />
43+
<Reference Include="Microsoft.CSharp" />
44+
<Reference Include="System.Data" />
45+
<Reference Include="System.Xml" />
46+
</ItemGroup>
47+
<ItemGroup>
48+
<Compile Include="SampleCode.cs" />
49+
<Compile Include="VisaCheckout\VisaCheckoutDecrypt.cs" />
50+
<Compile Include="Properties\AssemblyInfo.cs" />
51+
<Compile Include="VisaCheckout\VisaCheckoutTransaction.cs" />
52+
</ItemGroup>
53+
<ItemGroup>
54+
<None Include="App.config" />
55+
<None Include="packages.config" />
56+
</ItemGroup>
57+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
58+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
59+
Other similar extension points exist, see Microsoft.Common.targets.
60+
<Target Name="BeforeBuild">
61+
</Target>
62+
<Target Name="AfterBuild">
63+
</Target>
64+
-->
65+
</Project>

SampleCode.exe.config

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
5+
</startup>
6+
</configuration>

SampleCode.sln

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2012
4+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleCode", "SampleCode.csproj", "{EE8CB03C-AFF3-4480-AFD5-1C8B51540570}"
5+
EndProject
6+
Global
7+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8+
Debug|Any CPU = Debug|Any CPU
9+
Release|Any CPU = Release|Any CPU
10+
EndGlobalSection
11+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
12+
{EE8CB03C-AFF3-4480-AFD5-1C8B51540570}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13+
{EE8CB03C-AFF3-4480-AFD5-1C8B51540570}.Debug|Any CPU.Build.0 = Debug|Any CPU
14+
{EE8CB03C-AFF3-4480-AFD5-1C8B51540570}.Release|Any CPU.ActiveCfg = Release|Any CPU
15+
{EE8CB03C-AFF3-4480-AFD5-1C8B51540570}.Release|Any CPU.Build.0 = Release|Any CPU
16+
EndGlobalSection
17+
GlobalSection(SolutionProperties) = preSolution
18+
HideSolutionNode = FALSE
19+
EndGlobalSection
20+
EndGlobal

VisaCheckout/VisaCheckoutDecrypt.cs

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
using AuthorizeNet.Api.Contracts.V1;
2+
using AuthorizeNet.Api.Controllers;
3+
using AuthorizeNet.Api.Controllers.Bases;
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Linq;
7+
using System.Text;
8+
using System.Threading.Tasks;
9+
10+
namespace net.authorize.sample
11+
{
12+
class VisaCheckoutDecrypt
13+
{
14+
public static void Run()
15+
{
16+
Console.WriteLine("Running VisaCheckoutDecrypt Sample ...");
17+
18+
ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
19+
{
20+
name = "5KP3u95bQpv",
21+
ItemElementName = ItemChoiceType.transactionKey,
22+
Item = "4Ktq966gC55GAX7S",
23+
};
24+
25+
ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX;
26+
27+
//create a transaction
28+
var opaqueDataType = new opaqueDataType
29+
{
30+
dataDescriptor = "COMMON.VCO.ONLINE.PAYMENT",
31+
dataKey = "foFBEbhXljevQQasx5Q87hzj57xvUl4iBmXDdB1vs/Lm/M1uKJiF9V5QxI0A6NvAtIckMvutSl0Chz2SNoSeBuTRzK0y4IlfnfWKnJF7a1LV/bjZokTtFKINdZ+Ks9RB",
32+
dataValue = "AjHRw1gU/pQqLQLIElFPBV00dQkzQvZnhAd6XrpVI8MRzhatkmv5MVtggr7XkIfWtiVk8JJQDvuwYAQ6Hl/MNxFIgn7ygGbZm17yAoQpR9l0z0d93I92Oed5sxueqG46CaDCJm1W8zhm9ce8ARn6JyQtDokhHt3psxbfut8q/+cjl8jsIGKKLR+IgA3zPxO3vaL9JEum4bkE3oDJvQhlYJPTjtV3zJRe5n6prvDkMJ9deP0tyiRHaR8OB6BUrCMkyhDLS3ghn2Do7Dv+uN+7bRtj9SuTyUEvDhTx/o3PJ0ELdwBkdKvRh0sLcrK3LkBoto3ppq/a0WT+ckOEz5u+1pUvXAJtCRPHyILvyScFB39OUoxVSvvaBrBGgUaztGqRvVJNhqQmAYU2NQ5DgoWM8TcBzdQwdzqkczbs7egVQa/44+p78zWjzJxoG5cP7EQUNnUL7eaIj3ezbwBtz0ciwNsuCm2bs6vT0hB6GVXwkro5fcvV52Vd32wrpmRJYd20CjfuR7Nit4xKF8VTtmQ0c7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IP3TD1G8HOH508PBCLemVm7Q3TZSG3g+aw25URKTEg+KPpLEQykXYv32FIjM8B3Bq1Z+7t6kRc9u6xtMliAy/kz5UcxaTNlDfrsuw1AISX+3NZ0gIVsKbsZ+nCpnXuv9DeuI55Ccz1A99B2lG2d1zSa9Y+M0wX/KFIkN2wrv2Af7zSVt2ovxoGdbK1wkpErzkqmqupr5Bh16CpccHIsI+DV3yfwgmbaIg0YGaxLjKCoeLTF/RogEsw+2wJjqxgbIXJVtpS5sQqcUrUHpQGl5iee0V1BiGL6Z9qcoARMJ3JwY6FDw6Be7Le38LgONm5FRa7/CQFd8Gh0oyvPgyUKoxlLO1OvlXN8PJ4qMJGRKn6X7KwDrUpjv2pXIzO+t11WHUMprVYq3br0MPjnF6I8bi4CqpKUoYp6jUm4Prx4qCiY7UIWAYsPvjE4Vlp+o0ny0P3wiNGAHmD1bVeoFhsgXI0MIPTlsnYCCy6YkFBI/piXAo0ooxXKvIg6LR3zF0Hopaj85gL3fgIHo/Jo5HlH+z3C/C/5PGEapgDNnlB4jEfNQMOVeBlZZBVmJXIz8eQDMzsDApxp0NE+00HdsrLUbD5H/HbwUHoKK7ipypQltvF1ZQx6N69zllqeI5pwr0F4a+QPfKiPANbcT6qEaUm24K4iXMWQ/5kccHX2t"
33+
};
34+
35+
var decryptPaymentDataRequest = new decryptPaymentDataRequest()
36+
{
37+
opaqueData = opaqueDataType,
38+
callId = "1166739390571781401"
39+
};
40+
//create controller, execute and get response
41+
var decryptPaymentDataController = new decryptPaymentDataController(decryptPaymentDataRequest);
42+
decryptPaymentDataController.Execute();
43+
var decryptPaymentDataResponse = decryptPaymentDataController.GetApiResponse();
44+
45+
if (decryptPaymentDataResponse != null)
46+
{
47+
//validate response
48+
Console.WriteLine("Result : "+decryptPaymentDataResponse.messages.message);
49+
Console.WriteLine(" : "+decryptPaymentDataResponse.messages.resultCode);
50+
Console.WriteLine("First Name : "+decryptPaymentDataResponse.billingInfo.firstName);
51+
Console.WriteLine("Last name : "+decryptPaymentDataResponse.billingInfo.lastName);
52+
Console.WriteLine("Card Number : "+decryptPaymentDataResponse.cardInfo.cardNumber);
53+
Console.WriteLine("Amount : "+decryptPaymentDataResponse.paymentDetails.amount);
54+
}
55+
}
56+
}
57+
}
+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
using AuthorizeNet.Api.Contracts.V1;
2+
using AuthorizeNet.Api.Controllers;
3+
using AuthorizeNet.Api.Controllers.Bases;
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Linq;
7+
using System.Text;
8+
using System.Threading.Tasks;
9+
10+
namespace net.authorize.sample
11+
{
12+
class VisaCheckoutTransaction
13+
{
14+
public static void Run()
15+
{
16+
Console.WriteLine("Running VisaCheckoutTransaction Sample ...");
17+
// The test setup.
18+
ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
19+
{
20+
name = "5KP3u95bQpv",
21+
ItemElementName = ItemChoiceType.transactionKey,
22+
Item = "4Ktq966gC55GAX7S",
23+
};
24+
25+
ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX;
26+
27+
28+
//set up data based on transaction
29+
var transactionAmount = Convert.ToDecimal(25.60);
30+
var opaqueDataType = new opaqueDataType
31+
{
32+
dataDescriptor = "COMMON.VCO.ONLINE.PAYMENT",
33+
dataKey = "NQzcMISSxLX789w+CGX+tXi3lKntO1dpZbZaREOUprVRByJkg1xnpc2Wx9aT5/BLOxQmHqmIsjjy+tF6HqKKGwovvXjIS3fE3y3tBRNbz8D7y6vYMup+AWbEvZqDEBSi",
34+
dataValue = "+6hn53rUcggeZZti2IdBp3qNLa9ohAH87cFSc1BggZFNEpsrfdJbRViWwv/JbCNkHkOD6CpFlRO3gCDH2VEQTd8laqWR1ccHiZpdYDnOxfhUQpU9E18ZByW7j17puVWogh7HaItbDUL0YvIxxfClX9bohurOo1JHyUgBO9YxTj3CLY2RdRkjmipAQqOyxiGX9enF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FV9wEVlbGXiOiJfeZ0mEzo9ghDyKEAGEDzZtHDwZzKEYyT92oFXkeewGQ6DJX7GSQPZ1MW17jAQODAqmzJcmwMunc7PwGvJcscRbxkXpGe7/asq2H4POz3ByBrBQHCl/+oUVtw8hEbavCpuEgXfWl09Sc3Dfg69UP8XBR80vWsP1YL8YtBxOmL2hinZc5SJZ4boulAOHiMQyKBwwkg2D1gJDEY9JzUJtbg3p06swB0UthNmVuo/1mV8047sB5QrjGCugEo87+vh9eV1EVvyLZLRFS+RIZoIpLR3UkO6Pe1s7MnO7ZvCsbz9sKNb0GtQPoFtU9b7KaCHgQ20vL7xjqTEmR2QwkHEriuGJ8a7oMdSd88w/e2InL1SfHCnS2JeWY9vY6RSTvmjkEf3BFGhHjFP5QRR3Bd8AVH/1YrFcxtSSJP5GeY3CVnJgjZToK+ngxsRzpDcEm6pz3RPUEIBNkk3c9plpdlMbyvuVVKXLSFdTdtAALRfiD9qhdpgGMqboZ0kXi+qn3irYXT19q8oQktoZ4ILkbzewloftLbfUTqQprA8cddy7/ikUKKhBoBVs/DAupRe9aRP3TLgIEz6eNNilZszXoFfUv9EgqOZ0EBb83KNV3HvbE2xGJcTArjRpmzszQQkNOpJnyRDtvPj7FU7K16UYQ9zQBrxnx5vnoWSaqNhzOxikd+hWZ6i5G7EPpCO+utdoMdyOTOoDAjBmiy5JsDHSVv4zvkT9ySYPH2PmS47mMEpZICKTAxuDrm3zTpT064P+7ivcGmaIyaBCkc4udIHaWSbi5XJ/ciXUxSqAtqaVcd5HD++6vjBzKhbAPU4shSBav6qCSp/XqFurEAJbkLB3VmXe7bghcM+VNPJHHiYlIdzndDaFENyaZCukypggK0Gf4cH+8CKI9YnQx9s4JMs4lX57i4IkkoJE7fjWaOHyxYM/AiKvWlMQtRO8Y5Yta454JfHVq7Mg11Wqu2Ex4q5QLNqKudVt3wveu3G1zoNFanW6i+d0Aa3hTdxerl9BacX/"
35+
};
36+
37+
//standard api call to retrieve response
38+
var paymentType = new paymentType { Item = opaqueDataType };
39+
var transactionRequest = new transactionRequestType
40+
{
41+
transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),
42+
payment = paymentType,
43+
amount = transactionAmount,
44+
callId = "1482912778237697701"
45+
};
46+
var request = new createTransactionRequest { transactionRequest = transactionRequest };
47+
var controller = new createTransactionController(request);
48+
controller.Execute();
49+
var response = controller.GetApiResponse();
50+
51+
//validate
52+
if (response.messages.resultCode == messageTypeEnum.Ok)
53+
{
54+
if (response.transactionResponse != null)
55+
{
56+
Console.WriteLine("Success, Auth Code : " + response.transactionResponse.authCode);
57+
}
58+
}
59+
else
60+
{
61+
Console.WriteLine("Error: " + response.messages.message[0].code +" "+response.messages.message[0].text);
62+
if (response.transactionResponse != null)
63+
{
64+
Console.WriteLine("Transaction Error : " + response.transactionResponse.errors[0].errorCode + " " + response.transactionResponse.errors[0].errorText);
65+
}
66+
}
67+
68+
}
69+
}
70+
}

packages.config

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="AuthorizeNet" version="1.8.4" targetFramework="net45" />
4+
</packages>

0 commit comments

Comments
 (0)