diff --git a/CHANGELOG b/CHANGELOG index 1903482e..c287331a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,27 @@ = LitleOnline CHANGELOG +==Version 9.12.2 (May 19, 2017) +* Feature: add neutering of track data +* Feature: merge [pull request](https://github.com/LitleCo/litle-sdk-for-dotNet/pull/43#issuecomment-302479228) from @hyeomans + +==Version 9.12.1 (Apr 7, 2017) +* Bug fix: properly serialize boolean for fraudCheck + +==Version 9.12.0 +*Feature: updated to use XML v9.12 + +==Version 9.10.0 +* Feature: updated to use XML v9.10 +* Feature: pin support +* Feature: added processingType element +* Feature: added originalNetworkTransactionId +* Feature: added originalTransactionAmount +* Feature: AndroidPay support +* Feature: added wallet source: VisaCheckout + +==Version 9.3.3 +* Feature: adding signed dlls and signing our dll + ==Version 9.3.2 HTTP timeout is set to 500ms Add RecycleEngineActiveFlag diff --git a/CONTRIBUTORS b/CONTRIBUTORS index ff462af6..da05b330 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2,5 +2,6 @@ Tony Ranieri - https://github.com/LitleCo/litle-sdk-for-dotNet/pull/1 Dustin Chilson - https://github.com/LitleCo/litle-sdk-for-dotNet/pull/3 Justin Peck - https://github.com/LitleCo/litle-sdk-for-dotNet/pull/17 Lars Mikkelsen - https://github.com/LitleCo/litle-sdk-for-dotNet/pull/22 +salzersoftware - https://github.com/LitleCo/litle-sdk-for-dotNet/pull/41 https://github.com/LitleCo/litle-sdk-for-dotNet/pull/21 https://github.com/LitleCo/litle-sdk-for-dotNet/pull/19 diff --git a/LitleSdkForNet/.nuspec b/LitleSdkForNet/.nuspec new file mode 100644 index 00000000..e69de29b diff --git a/LitleSdkForNet/LitleSdkForNet.nunit b/LitleSdkForNet/LitleSdkForNet.nunit index 9c2ea7bf..776a7337 100644 --- a/LitleSdkForNet/LitleSdkForNet.nunit +++ b/LitleSdkForNet/LitleSdkForNet.nunit @@ -1,11 +1,11 @@  - + - + \ No newline at end of file diff --git a/LitleSdkForNet/LitleSdkForNet.sln b/LitleSdkForNet/LitleSdkForNet.sln index 742ecf5f..feeec21e 100644 --- a/LitleSdkForNet/LitleSdkForNet.sln +++ b/LitleSdkForNet/LitleSdkForNet.sln @@ -1,50 +1,40 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Express 2013 for Windows Desktop -VisualStudioVersion = 12.0.21005.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LitleSdkForNet", "LitleSdkForNet\LitleSdkForNet.csproj", "{4A6E3397-DE37-4F91-A90F-E74C1D91E098}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LitleSdkForNetTest", "LitleSdkForNetTest\LitleSdkForNetTest.csproj", "{D0A0B9E4-E555-498D-910D-28C61BD094EF}" - ProjectSection(ProjectDependencies) = postProject - {4A6E3397-DE37-4F91-A90F-E74C1D91E098} = {4A6E3397-DE37-4F91-A90F-E74C1D91E098} - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{29B822AC-38E2-4105-AEEB-DE8A4FDD6952}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|Mixed Platforms = Debug|Mixed Platforms - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|Mixed Platforms = Release|Mixed Platforms - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4A6E3397-DE37-4F91-A90F-E74C1D91E098}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4A6E3397-DE37-4F91-A90F-E74C1D91E098}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4A6E3397-DE37-4F91-A90F-E74C1D91E098}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {4A6E3397-DE37-4F91-A90F-E74C1D91E098}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {4A6E3397-DE37-4F91-A90F-E74C1D91E098}.Debug|x86.ActiveCfg = Debug|Any CPU - {4A6E3397-DE37-4F91-A90F-E74C1D91E098}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4A6E3397-DE37-4F91-A90F-E74C1D91E098}.Release|Any CPU.Build.0 = Release|Any CPU - {4A6E3397-DE37-4F91-A90F-E74C1D91E098}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {4A6E3397-DE37-4F91-A90F-E74C1D91E098}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {4A6E3397-DE37-4F91-A90F-E74C1D91E098}.Release|x86.ActiveCfg = Release|Any CPU - {D0A0B9E4-E555-498D-910D-28C61BD094EF}.Debug|Any CPU.ActiveCfg = Debug|x86 - {D0A0B9E4-E555-498D-910D-28C61BD094EF}.Debug|Any CPU.Build.0 = Debug|x86 - {D0A0B9E4-E555-498D-910D-28C61BD094EF}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {D0A0B9E4-E555-498D-910D-28C61BD094EF}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {D0A0B9E4-E555-498D-910D-28C61BD094EF}.Debug|x86.ActiveCfg = Debug|x86 - {D0A0B9E4-E555-498D-910D-28C61BD094EF}.Debug|x86.Build.0 = Debug|x86 - {D0A0B9E4-E555-498D-910D-28C61BD094EF}.Release|Any CPU.ActiveCfg = Release|x86 - {D0A0B9E4-E555-498D-910D-28C61BD094EF}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {D0A0B9E4-E555-498D-910D-28C61BD094EF}.Release|Mixed Platforms.Build.0 = Release|x86 - {D0A0B9E4-E555-498D-910D-28C61BD094EF}.Release|x86.ActiveCfg = Release|x86 - {D0A0B9E4-E555-498D-910D-28C61BD094EF}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31229.75 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LitleSdkForNet", "LitleSdkForNet\LitleSdkForNet.csproj", "{4A6E3397-DE37-4F91-A90F-E74C1D91E098}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{29B822AC-38E2-4105-AEEB-DE8A4FDD6952}" + ProjectSection(SolutionItems) = preProject + LitleSdkForNet\XmlRequestFields.cs = LitleSdkForNet\XmlRequestFields.cs + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4A6E3397-DE37-4F91-A90F-E74C1D91E098}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4A6E3397-DE37-4F91-A90F-E74C1D91E098}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4A6E3397-DE37-4F91-A90F-E74C1D91E098}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {4A6E3397-DE37-4F91-A90F-E74C1D91E098}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {4A6E3397-DE37-4F91-A90F-E74C1D91E098}.Debug|x86.ActiveCfg = Debug|Any CPU + {4A6E3397-DE37-4F91-A90F-E74C1D91E098}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4A6E3397-DE37-4F91-A90F-E74C1D91E098}.Release|Any CPU.Build.0 = Release|Any CPU + {4A6E3397-DE37-4F91-A90F-E74C1D91E098}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {4A6E3397-DE37-4F91-A90F-E74C1D91E098}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {4A6E3397-DE37-4F91-A90F-E74C1D91E098}.Release|x86.ActiveCfg = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F8980669-2DB1-411F-AFBD-534BA79DE5E8} + EndGlobalSection +EndGlobal diff --git a/LitleSdkForNet/LitleSdkForNet/Communications.cs b/LitleSdkForNet/LitleSdkForNet/Communications.cs index ec107db0..1d63f22b 100644 --- a/LitleSdkForNet/LitleSdkForNet/Communications.cs +++ b/LitleSdkForNet/LitleSdkForNet/Communications.cs @@ -1,27 +1,21 @@ using System; using System.IO; -using System.Xml; -using System.Xml.Serialization; using System.Collections.Generic; using System.Diagnostics; -using System.Text; -using System.Xml.XPath; +using System.Globalization; using System.Net; using Tamir.SharpSsh.jsch; -using Tamir.SharpSsh; -using System.Timers; using System.Net.Sockets; using System.Net.Security; using System.Security.Authentication; using System.Security.Cryptography.X509Certificates; -using System.Reflection; using System.Text.RegularExpressions; namespace Litle.Sdk { public class Communications { - private static readonly object _synLock = new object(); + private static readonly object SynLock = new object(); public static bool ValidateServerCertificate( @@ -39,35 +33,39 @@ public static bool ValidateServerCertificate( return false; } - public void neuterXML(ref string inputXml) + public void NeuterXml(ref string inputXml) { + const string pattern1 = "(?i).*?"; + const string pattern2 = "(?i).*?"; + const string pattern3 = "(?i).*?"; - string pattern1 = "(?i).*?"; - string pattern2 = "(?i).*?"; - - Regex rgx1 = new Regex(pattern1); - Regex rgx2 = new Regex(pattern2); + var rgx1 = new Regex(pattern1); + var rgx2 = new Regex(pattern2); + var rgx3 = new Regex(pattern3); inputXml = rgx1.Replace(inputXml, "xxxxxxxxxxxxxxxx"); inputXml = rgx2.Replace(inputXml, "xxxxxxxxxx"); + inputXml = rgx3.Replace(inputXml, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); } - public void log(String logMessage, String logFile, bool neuter) + public void Log(string logMessage, string logFile, bool neuter) { - lock (_synLock) + lock (SynLock) { if (neuter) { - neuterXML(ref logMessage); + NeuterXml(ref logMessage); + } + + using (var logWriter = new StreamWriter(logFile, true)) + { + var time = DateTime.Now; + logWriter.WriteLine(time.ToString(CultureInfo.InvariantCulture)); + logWriter.WriteLine(logMessage + "\r\n"); } - StreamWriter logWriter = new StreamWriter(logFile, true); - DateTime time = DateTime.Now; - logWriter.WriteLine(time.ToString()); - logWriter.WriteLine(logMessage + "\r\n"); - logWriter.Close(); } } - virtual public string HttpPost(string xmlRequest, Dictionary config) + public virtual string HttpPost(string xmlRequest, Dictionary config) { string logFile = null; if (config.ContainsKey("logFile")) @@ -75,17 +73,17 @@ virtual public string HttpPost(string xmlRequest, Dictionary con logFile = config["logFile"]; } - string uri = config["url"]; - System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls; - System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(uri); + var uri = config["url"]; + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls; + var req = (HttpWebRequest)WebRequest.Create(uri); - bool neuter = false; + var neuter = false; if (config.ContainsKey("neuterAccountNums")) { neuter = ("true".Equals(config["neuterAccountNums"])); } - bool printxml = false; + var printxml = false; if (config.ContainsKey("printxml")) { if("true".Equals(config["printxml"])) { @@ -100,17 +98,20 @@ virtual public string HttpPost(string xmlRequest, Dictionary con //log request if (logFile != null) { - log(xmlRequest,logFile, neuter); + Log(xmlRequest,logFile, neuter); } - req.ContentType = "text/xml"; + req.ContentType = "text/xml; charset=UTF-8"; req.Method = "POST"; req.ServicePoint.MaxIdleTime = 10000; req.ServicePoint.Expect100Continue = false; - if (isProxyOn(config)) + req.KeepAlive = false; + if (IsProxyOn(config)) { - WebProxy myproxy = new WebProxy(config["proxyHost"], int.Parse(config["proxyPort"])); - myproxy.BypassProxyOnLocal = true; + var myproxy = new WebProxy(config["proxyHost"], int.Parse(config["proxyPort"])) + { + BypassProxyOnLocal = true + }; req.Proxy = myproxy; } @@ -119,17 +120,11 @@ virtual public string HttpPost(string xmlRequest, Dictionary con { writer.Write(xmlRequest); } - - - + // read response - System.Net.WebResponse resp = req.GetResponse(); - if (resp == null) - { - return null; - } + var resp = req.GetResponse(); string xmlResponse; - using (var reader = new System.IO.StreamReader(resp.GetResponseStream())) + using (var reader = new StreamReader(resp.GetResponseStream())) { xmlResponse = reader.ReadToEnd().Trim(); } @@ -141,27 +136,27 @@ virtual public string HttpPost(string xmlRequest, Dictionary con //log response if (logFile != null) { - log(xmlResponse,logFile,neuter); + Log(xmlResponse,logFile,neuter); } return xmlResponse; } - public bool isProxyOn(Dictionary config) { + public bool IsProxyOn(Dictionary config) { return config.ContainsKey("proxyHost") && config["proxyHost"] != null && config["proxyHost"].Length > 0 && config.ContainsKey("proxyPort") && config["proxyPort"] != null && config["proxyPort"].Length > 0; } - virtual public string socketStream(string xmlRequestFilePath, string xmlResponseDestinationDirectory, Dictionary config) + public virtual string SocketStream(string xmlRequestFilePath, string xmlResponseDestinationDirectory, Dictionary config) { - string url = config["onlineBatchUrl"]; - int port = Int32.Parse(config["onlineBatchPort"]); - TcpClient tcpClient = null; - SslStream sslStream = null; + var url = config["onlineBatchUrl"]; + var port = int.Parse(config["onlineBatchPort"]); + TcpClient tcpClient; + SslStream sslStream; try { tcpClient = new TcpClient(url, port); - sslStream = new SslStream(tcpClient.GetStream(), false, new RemoteCertificateValidationCallback(ValidateServerCertificate), null); + sslStream = new SslStream(tcpClient.GetStream(), false, ValidateServerCertificate, null); } catch (SocketException e) { @@ -183,14 +178,13 @@ virtual public string socketStream(string xmlRequestFilePath, string xmlResponse Console.WriteLine("Using XML File: " + xmlRequestFilePath); } - using (FileStream readFileStream = new FileStream(xmlRequestFilePath, FileMode.Open)) + using (var readFileStream = new FileStream(xmlRequestFilePath, FileMode.Open)) { - int bytesRead = -1; - byte[] byteBuffer; + int bytesRead; do { - byteBuffer = new byte[1024 * sizeof(char)]; + var byteBuffer = new byte[1024 * sizeof(char)]; bytesRead = readFileStream.Read(byteBuffer, 0, byteBuffer.Length); sslStream.Write(byteBuffer, 0, bytesRead); @@ -198,30 +192,23 @@ virtual public string socketStream(string xmlRequestFilePath, string xmlResponse } while (bytesRead != 0); } - string batchName = Path.GetFileName(xmlRequestFilePath); - string destinationDirectory = Path.GetDirectoryName(xmlResponseDestinationDirectory); - if (!Directory.Exists(destinationDirectory)) - { - Directory.CreateDirectory(destinationDirectory); - } + var batchName = Path.GetFileName(xmlRequestFilePath); + var destinationDirectory = Path.GetDirectoryName(xmlResponseDestinationDirectory); + if (destinationDirectory != null && !Directory.Exists(destinationDirectory)) Directory.CreateDirectory(destinationDirectory); if ("true".Equals(config["printxml"])) { Console.WriteLine("Writing to XML File: " + xmlResponseDestinationDirectory + batchName); } - using (FileStream writeFileStream = new FileStream(xmlResponseDestinationDirectory + batchName, FileMode.Create)) + using (var writeFileStream = new FileStream(xmlResponseDestinationDirectory + batchName, FileMode.Create)) { - char[] charBuffer; - byte[] byteBuffer; - int bytesRead = 0; + int bytesRead; do { - charBuffer = new char[1024]; - byteBuffer = new byte[1024 * sizeof(char)]; + var byteBuffer = new byte[1024 * sizeof(char)]; bytesRead = sslStream.Read(byteBuffer, 0, byteBuffer.Length); - charBuffer = Encoding.UTF8.GetChars(byteBuffer); writeFileStream.Write(byteBuffer, 0, bytesRead); } while (bytesRead > 0); @@ -233,18 +220,17 @@ virtual public string socketStream(string xmlRequestFilePath, string xmlResponse return xmlResponseDestinationDirectory + batchName; } - virtual public void FtpDropOff(string fileDirectory, string fileName, Dictionary config) + public virtual void FtpDropOff(string fileDirectory, string fileName, Dictionary config) { - ChannelSftp channelSftp = null; - Channel channel; + ChannelSftp channelSftp; - string url = config["sftpUrl"]; - string username = config["sftpUsername"]; - string password = config["sftpPassword"]; - string knownHostsFile = config["knownHostsFile"]; - string filePath = fileDirectory + fileName; + var url = config["sftpUrl"]; + var username = config["sftpUsername"]; + var password = config["sftpPassword"]; + var knownHostsFile = config["knownHostsFile"]; + var filePath = fileDirectory + fileName; - bool printxml = config["printxml"] == "true"; + var printxml = config["printxml"] == "true"; if (printxml) { Console.WriteLine("Sftp Url: " + url); @@ -253,23 +239,61 @@ virtual public void FtpDropOff(string fileDirectory, string fileName, Dictionary Console.WriteLine("Known hosts file path: " + knownHostsFile); } - JSch jsch = new JSch(); + var jsch = new JSch(); + + if (printxml) + { + // grab the contents fo the knownhosts file and print + var hostFile = File.ReadAllText(knownHostsFile); + Console.WriteLine("known host contents: " + hostFile); + } + jsch.setKnownHosts(knownHostsFile); - Session session = jsch.getSession(username, url); + // setup for diagnostic + // Get the KnownHosts repository from JSchs + var hkr = jsch.getHostKeyRepository(); + var hks = hkr.getHostKey(); + HostKey hk; + if (printxml) + { + // Print all knownhosts and keys + if (hks != null) + { + Console.WriteLine(); + Console.WriteLine("Host keys in " + hkr.getKnownHostsRepositoryID() + ":"); + foreach (var t in hks) + { + hk = t; + Console.WriteLine("local HostKey host: <" + hk.getHost() + "> type: <" + hk.getType() + "> fingerprint: <" + hk.getFingerPrint(jsch) + ">"); + } + Console.WriteLine(""); + } + } + + + var session = jsch.getSession(username, url); session.setPassword(password); try { session.connect(); - channel = session.openChannel("sftp"); + // more diagnostic code for troubleshooting sFTP connection errors + if (printxml) + { + // Print the host key info of the connected server: + hk = session.getHostKey(); + Console.WriteLine("remote HostKey host: <" + hk.getHost() + "> type: <" + hk.getType() + "> fingerprint: <" + hk.getFingerPrint(jsch) + ">"); + } + + var channel = session.openChannel("sftp"); channel.connect(); channelSftp = (ChannelSftp)channel; } catch (SftpException e) { - throw new LitleOnlineException("Error occured while attempting to establish an SFTP connection",e); + throw new LitleOnlineException("Error occured while attempting to establish an SFTP connection", e); } catch (JSchException e) { @@ -299,33 +323,32 @@ virtual public void FtpDropOff(string fileDirectory, string fileName, Dictionary session.disconnect(); } - virtual public void FtpPoll(string fileName, int timeout, Dictionary config) + public virtual void FtpPoll(string fileName, int timeout, Dictionary config) { fileName = fileName + ".asc"; - bool printxml = config["printxml"] == "true"; + var printxml = config["printxml"] == "true"; if (printxml) { Console.WriteLine("Polling for outbound result file. Timeout set to " + timeout + "ms. File to wait for is " + fileName); } - ChannelSftp channelSftp = null; - Channel channel; + ChannelSftp channelSftp; - string url = config["sftpUrl"]; - string username = config["sftpUsername"]; - string password = config["sftpPassword"]; - string knownHostsFile = config["knownHostsFile"]; + var url = config["sftpUrl"]; + var username = config["sftpUsername"]; + var password = config["sftpPassword"]; + var knownHostsFile = config["knownHostsFile"]; - JSch jsch = new JSch(); + var jsch = new JSch(); jsch.setKnownHosts(knownHostsFile); - Session session = jsch.getSession(username, url); + var session = jsch.getSession(username, url); session.setPassword(password); try { session.connect(); - channel = session.openChannel("sftp"); + var channel = session.openChannel("sftp"); channel.connect(); channelSftp = (ChannelSftp)channel; } @@ -335,8 +358,8 @@ virtual public void FtpPoll(string fileName, int timeout, Dictionary config, string fileName) + public virtual void FtpPickUp(string destinationFilePath, Dictionary config, string fileName) { - ChannelSftp channelSftp = null; - Channel channel; + ChannelSftp channelSftp; - bool printxml = config["printxml"] == "true"; + var printxml = config["printxml"] == "true"; - string url = config["sftpUrl"]; - string username = config["sftpUsername"]; - string password = config["sftpPassword"]; - string knownHostsFile = config["knownHostsFile"]; + var url = config["sftpUrl"]; + var username = config["sftpUsername"]; + var password = config["sftpPassword"]; + var knownHostsFile = config["knownHostsFile"]; - JSch jsch = new JSch(); + var jsch = new JSch(); jsch.setKnownHosts(knownHostsFile); - Session session = jsch.getSession(username, url); + var session = jsch.getSession(username, url); session.setPassword(password); try { session.connect(); - channel = session.openChannel("sftp"); + var channel = session.openChannel("sftp"); channel.connect(); channelSftp = (ChannelSftp)channel; } diff --git a/LitleSdkForNet/LitleSdkForNet/LitleBatch.cs b/LitleSdkForNet/LitleSdkForNet/LitleBatch.cs index 5a095330..d0169a93 100644 --- a/LitleSdkForNet/LitleSdkForNet/LitleBatch.cs +++ b/LitleSdkForNet/LitleSdkForNet/LitleBatch.cs @@ -1,8 +1,5 @@ using System; using System.Collections.Generic; -using System.Text; -using System.Xml; -using System.Xml.Serialization; using System.IO; using System.Security.Cryptography; @@ -11,13 +8,13 @@ namespace Litle.Sdk public class litleRequest { private authentication authentication; - private Dictionary config; + private Dictionary config; private Communications communication; private litleXmlSerializer litleXmlSerializer; - private int numOfLitleBatchRequest = 0; - private int numOfRFRRequest = 0; - public string finalFilePath = null; - private string batchFilePath = null; + private int numOfLitleBatchRequest; + private int numOfRFRRequest; + public string finalFilePath; + private string batchFilePath; private string requestDirectory; private string responseDirectory; private litleTime litleTime; @@ -29,7 +26,7 @@ public class litleRequest public litleRequest() { config = new Dictionary(); - + config["url"] = Properties.Settings.Default.url; config["reportGroup"] = Properties.Settings.Default.reportGroup; config["username"] = Properties.Settings.Default.username; @@ -75,7 +72,7 @@ public litleRequest() * requestDirectory * responseDirectory */ - public litleRequest(Dictionary config) + public litleRequest(Dictionary config) { this.config = config; @@ -186,7 +183,7 @@ public litleResponse sendToLitleWithStream() string requestFilePath = this.Serialize(); string batchName = Path.GetFileName(requestFilePath); - string responseFilePath = communication.socketStream(requestFilePath, responseDirectory, config); + string responseFilePath = communication.SocketStream(requestFilePath, responseDirectory, config); litleResponse litleResponse = (litleResponse)litleXmlSerializer.DeserializeObjectFromFile(responseFilePath); return litleResponse; @@ -239,11 +236,8 @@ public string SerializeRFRRequestToFile(RFRRequest rfrRequest, string filePath) public string Serialize() { - string xmlHeader = "\r\n"; - - string xmlFooter = "\r\n"; + string xmlHeader = generateXmlHeader(); + string xmlFooter = generateXmlFooter(); string filePath; @@ -269,6 +263,22 @@ public string Serialize() return filePath; } + public string generateXmlHeader() + { + string xmlHeader = "\r\n"; + + return xmlHeader; + } + + public string generateXmlFooter() + { + const string xmlFooter = "\r\n"; + + return xmlFooter; + } + private void fillInReportGroup(batchRequest litleBatchRequest) { if (litleBatchRequest.reportGroup == null) @@ -283,8 +293,8 @@ public class litleFile { public virtual string createRandomFile(string fileDirectory, string fileName, string fileExtension, litleTime litleTime) { - string filePath = null; - if (fileName == null || fileName == String.Empty) + string filePath; + if (string.IsNullOrEmpty(fileName)) { if (!Directory.Exists(fileDirectory)) { @@ -294,7 +304,7 @@ public virtual string createRandomFile(string fileDirectory, string fileName, st fileName = litleTime.getCurrentTime("MM-dd-yyyy_HH-mm-ss-ffff_") + RandomGen.NextString(8); filePath = fileDirectory + fileName + fileExtension; - using (FileStream fs = new FileStream(filePath, FileMode.Create)) + using (new FileStream(filePath, FileMode.Create)) { } } @@ -308,8 +318,8 @@ public virtual string createRandomFile(string fileDirectory, string fileName, st public virtual string AppendLineToFile(string filePath, string lineToAppend) { - using (FileStream fs = new FileStream(filePath, FileMode.Append)) - using (StreamWriter sw = new StreamWriter(fs)) + using (var fs = new FileStream(filePath, FileMode.Append)) + using (var sw = new StreamWriter(fs)) { sw.Write(lineToAppend); } @@ -321,8 +331,8 @@ public virtual string AppendLineToFile(string filePath, string lineToAppend) public virtual string AppendFileToFile(string filePathToAppendTo, string filePathToAppend) { - using (FileStream fs = new FileStream(filePathToAppendTo, FileMode.Append)) - using (FileStream fsr = new FileStream(filePathToAppend, FileMode.Open)) + using (var fs = new FileStream(filePathToAppendTo, FileMode.Append)) + using (var fsr = new FileStream(filePathToAppend, FileMode.Open)) { byte[] buffer = new byte[16]; @@ -343,7 +353,7 @@ public virtual string AppendFileToFile(string filePathToAppendTo, string filePat public virtual void createDirectory(string destinationFilePath) { - string destinationDirectory = Path.GetDirectoryName(destinationFilePath); + var destinationDirectory = Path.GetDirectoryName(destinationFilePath); if (!Directory.Exists(destinationDirectory)) { @@ -354,7 +364,7 @@ public virtual void createDirectory(string destinationFilePath) public static class RandomGen { - private static RNGCryptoServiceProvider _global = new RNGCryptoServiceProvider(); + private static readonly RNGCryptoServiceProvider Global = new RNGCryptoServiceProvider(); private static Random _local; public static int NextInt() { @@ -362,7 +372,7 @@ public static int NextInt() if (inst == null) { byte[] buffer = new byte[8]; - _global.GetBytes(buffer); + Global.GetBytes(buffer); _local = inst = new Random(BitConverter.ToInt32(buffer, 0)); } @@ -373,7 +383,7 @@ public static string NextString(int length) { string result = ""; - for (int i = 0; i < length; i++) + for (var i = 0; i < length; i++) { result += Convert.ToChar(NextInt() % ('Z' - 'A') + 'A'); } @@ -384,7 +394,7 @@ public static string NextString(int length) public class litleTime { - public virtual String getCurrentTime(String format) + public virtual string getCurrentTime(string format) { return DateTime.Now.ToString(format); } diff --git a/LitleSdkForNet/LitleSdkForNet/LitleBatchRequest.cs b/LitleSdkForNet/LitleSdkForNet/LitleBatchRequest.cs index 44043d76..feebdaf2 100644 --- a/LitleSdkForNet/LitleSdkForNet/LitleBatchRequest.cs +++ b/LitleSdkForNet/LitleSdkForNet/LitleBatchRequest.cs @@ -12,7 +12,7 @@ public partial class batchRequest public string merchantId; public string reportGroup; - public Dictionary config; + public Dictionary config; public string batchFilePath; private string tempBatchFilePath; @@ -85,7 +85,7 @@ public partial class batchRequest public batchRequest() { - config = new Dictionary(); + config = new Dictionary(); config["url"] = Properties.Settings.Default.url; config["reportGroup"] = Properties.Settings.Default.reportGroup; @@ -106,7 +106,7 @@ public batchRequest() initializeRequest(); } - public batchRequest(Dictionary config) + public batchRequest(Dictionary config) { this.config = config; @@ -995,11 +995,10 @@ public void addPhysicalCheckDebit(physicalCheckDebit physicalCheckDebit) } } - public String Serialize() + public string Serialize() { - string xmlHeader = generateXmlHeader(); - - string xmlFooter = "\r\n"; + var xmlHeader = generateXmlHeader(); + var xmlFooter = generateXmlFooter(); batchFilePath = litleFile.createRandomFile(requestDirectory, null, "_batchRequest.xml", litleTime); @@ -1231,12 +1230,19 @@ public string generateXmlHeader() xmlHeader += "physicalCheckDebitAmount=\"" + physicalCheckDebitAmount + "\"\r\n"; } - xmlHeader += "merchantSdk=\"DotNet;9.3.2\"\r\n"; + xmlHeader += "merchantSdk=\"DotNet;9.12.2\"\r\n"; xmlHeader += "merchantId=\"" + config["merchantId"] + "\">\r\n"; return xmlHeader; } + public string generateXmlFooter() + { + const string xmlFooter = "\r\n"; + + return xmlFooter; + } + private string saveElement(litleFile litleFile, litleTime litleTime, string filePath, transactionRequest element) { string fPath; @@ -1314,11 +1320,11 @@ public class RFRRequest private string requestDirectory; private string responseDirectory; - private Dictionary config; + private Dictionary config; public RFRRequest() { - config = new Dictionary(); + config = new Dictionary(); config["url"] = Properties.Settings.Default.url; config["reportGroup"] = Properties.Settings.Default.reportGroup; @@ -1343,7 +1349,7 @@ public RFRRequest() responseDirectory = config["responseDirectory"] + "\\Responses\\"; } - public RFRRequest(Dictionary config) + public RFRRequest(Dictionary config) { this.config = config; @@ -1369,7 +1375,7 @@ public string getResponseDirectory() return this.responseDirectory; } - public void setConfig(Dictionary config) + public void setConfig(Dictionary config) { this.config = config; } diff --git a/LitleSdkForNet/LitleSdkForNet/LitleOnline.cs b/LitleSdkForNet/LitleSdkForNet/LitleOnline.cs index c8c7c149..6663ea22 100644 --- a/LitleSdkForNet/LitleSdkForNet/LitleOnline.cs +++ b/LitleSdkForNet/LitleSdkForNet/LitleOnline.cs @@ -374,11 +374,22 @@ public unloadReversalResponse UnloadReversal(unloadReversal unloadReversal) return unloadReversalResponse; } + public fraudCheckResponse FraudCheck(fraudCheck fraudCheck) + { + litleOnlineRequest request = createLitleOnlineRequest(); + fillInReportGroup(fraudCheck); + request.fraudCheck = fraudCheck; + + litleOnlineResponse response = sendToLitle(request); + fraudCheckResponse fraudCheckResponse = (fraudCheckResponse)response.fraudCheckResponse; + return fraudCheckResponse; + } + private litleOnlineRequest createLitleOnlineRequest() { litleOnlineRequest request = new litleOnlineRequest(); request.merchantId = config["merchantId"]; - request.merchantSdk = "DotNet;9.3.2"; + request.merchantSdk = "DotNet;9.12.2"; authentication authentication = new authentication(); authentication.password = config["password"]; authentication.user = config["username"]; diff --git a/LitleSdkForNet/LitleSdkForNet/LitleSdkForNet.csproj b/LitleSdkForNet/LitleSdkForNet/LitleSdkForNet.csproj index 3a0d16a5..fc1d9c59 100644 --- a/LitleSdkForNet/LitleSdkForNet/LitleSdkForNet.csproj +++ b/LitleSdkForNet/LitleSdkForNet/LitleSdkForNet.csproj @@ -1,88 +1,41 @@ - - + - Debug - AnyCPU - 8.0.30703 - 2.0 - {4A6E3397-DE37-4F91-A90F-E74C1D91E098} Library Properties Litle.Sdk - LitleSdkForDotNet - v4.5 - 512 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - bin\Debug\ - TRACE - prompt - 4 - false + LitleSdkForNet + netstandard2.0 + latest + + false + - - - + + + + + + False lib\Tamir.SharpSSH.dll + - - - - - - - - - - - - - True + + + + + True + True Settings.settings - - - - Designer - - + PublicSettingsSingleFileGenerator Settings.Designer.cs - - - - - - - - - - \ No newline at end of file diff --git a/LitleSdkForNet/LitleSdkForNet/Properties/AssemblyInfo.cs b/LitleSdkForNet/LitleSdkForNet/Properties/AssemblyInfo.cs index 67b6d859..fcffa43e 100644 --- a/LitleSdkForNet/LitleSdkForNet/Properties/AssemblyInfo.cs +++ b/LitleSdkForNet/LitleSdkForNet/Properties/AssemblyInfo.cs @@ -8,9 +8,9 @@ [assembly: AssemblyTitle("LitleSdkForNet")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Litle & Co.")] +[assembly: AssemblyCompany("Vantiv")] [assembly: AssemblyProduct("LitleSdkForNet")] -[assembly: AssemblyCopyright("Copyright © Litle & Co. 2012")] +[assembly: AssemblyCopyright("Copyright © Vantiv 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("9.3.2")] -[assembly: AssemblyFileVersion("9.3.2")] +[assembly: AssemblyVersion("9.12.2")] +[assembly: AssemblyFileVersion("9.12.2")] diff --git a/LitleSdkForNet/LitleSdkForNet/Properties/Settings.Designer.cs b/LitleSdkForNet/LitleSdkForNet/Properties/Settings.Designer.cs index 0fb741e2..41c354d3 100644 --- a/LitleSdkForNet/LitleSdkForNet/Properties/Settings.Designer.cs +++ b/LitleSdkForNet/LitleSdkForNet/Properties/Settings.Designer.cs @@ -1,254 +1,254 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.34209 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Litle.Sdk.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] - public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("Default Report Group")] - public string reportGroup { - get { - return ((string)(this["reportGroup"])); - } - set { - this["reportGroup"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("true")] - public string printxml { - get { - return ((string)(this["printxml"])); - } - set { - this["printxml"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("500")] - public string timeout { - get { - return ((string)(this["timeout"])); - } - set { - this["timeout"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("prelive.litle.com")] - public string sftpUrl { - get { - return ((string)(this["sftpUrl"])); - } - set { - this["sftpUrl"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("C:\\Litle\\dll\\knownhosts")] - public string knownHostsFile { - get { - return ((string)(this["knownHostsFile"])); - } - set { - this["knownHostsFile"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("dotnet")] - public string sftpUsername { - get { - return ((string)(this["sftpUsername"])); - } - set { - this["sftpUsername"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("dotnet")] - public string sftpPassword { - get { - return ((string)(this["sftpPassword"])); - } - set { - this["sftpPassword"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("prelive.litle.com")] - public string onlineBatchUrl { - get { - return ((string)(this["onlineBatchUrl"])); - } - set { - this["onlineBatchUrl"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("15000")] - public string onlineBatchPort { - get { - return ((string)(this["onlineBatchPort"])); - } - set { - this["onlineBatchPort"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("C:\\Litle\\")] - public string requestDirectory { - get { - return ((string)(this["requestDirectory"])); - } - set { - this["requestDirectory"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("C:\\Litle\\")] - public string responseDirectory { - get { - return ((string)(this["responseDirectory"])); - } - set { - this["responseDirectory"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("null")] - public string logFile { - get { - return ((string)(this["logFile"])); - } - set { - this["logFile"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("true")] - public string neuterAccountNums { - get { - return ((string)(this["neuterAccountNums"])); - } - set { - this["neuterAccountNums"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("https://www.testlitle.com/sandbox/communicator/online")] - public string url { - get { - return ((string)(this["url"])); - } - set { - this["url"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string proxyHost { - get { - return ((string)(this["proxyHost"])); - } - set { - this["proxyHost"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string proxyPort { - get { - return ((string)(this["proxyPort"])); - } - set { - this["proxyPort"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("dotnet")] - public string username { - get { - return ((string)(this["username"])); - } - set { - this["username"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("dotnet")] - public string password { - get { - return ((string)(this["password"])); - } - set { - this["password"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("011")] - public string merchantId { - get { - return ((string)(this["merchantId"])); - } - set { - this["merchantId"] = value; - } - } - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Litle.Sdk.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")] + public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Default Report Group")] + public string reportGroup { + get { + return ((string)(this["reportGroup"])); + } + set { + this["reportGroup"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("true")] + public string printxml { + get { + return ((string)(this["printxml"])); + } + set { + this["printxml"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("500")] + public string timeout { + get { + return ((string)(this["timeout"])); + } + set { + this["timeout"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("prelive.litle.com")] + public string sftpUrl { + get { + return ((string)(this["sftpUrl"])); + } + set { + this["sftpUrl"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("C:\\Litle\\dll\\knownhosts")] + public string knownHostsFile { + get { + return ((string)(this["knownHostsFile"])); + } + set { + this["knownHostsFile"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("dotnet")] + public string sftpUsername { + get { + return ((string)(this["sftpUsername"])); + } + set { + this["sftpUsername"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("dotnet")] + public string sftpPassword { + get { + return ((string)(this["sftpPassword"])); + } + set { + this["sftpPassword"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("prelive.litle.com")] + public string onlineBatchUrl { + get { + return ((string)(this["onlineBatchUrl"])); + } + set { + this["onlineBatchUrl"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("15000")] + public string onlineBatchPort { + get { + return ((string)(this["onlineBatchPort"])); + } + set { + this["onlineBatchPort"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("C:\\Litle\\")] + public string requestDirectory { + get { + return ((string)(this["requestDirectory"])); + } + set { + this["requestDirectory"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("C:\\Litle\\")] + public string responseDirectory { + get { + return ((string)(this["responseDirectory"])); + } + set { + this["responseDirectory"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("null")] + public string logFile { + get { + return ((string)(this["logFile"])); + } + set { + this["logFile"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("true")] + public string neuterAccountNums { + get { + return ((string)(this["neuterAccountNums"])); + } + set { + this["neuterAccountNums"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("https://prelive.litle.com/vap/communicator/online")] + public string url { + get { + return ((string)(this["url"])); + } + set { + this["url"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string proxyHost { + get { + return ((string)(this["proxyHost"])); + } + set { + this["proxyHost"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string proxyPort { + get { + return ((string)(this["proxyPort"])); + } + set { + this["proxyPort"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("dotnet")] + public string username { + get { + return ((string)(this["username"])); + } + set { + this["username"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("dotnet")] + public string password { + get { + return ((string)(this["password"])); + } + set { + this["password"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("011")] + public string merchantId { + get { + return ((string)(this["merchantId"])); + } + set { + this["merchantId"] = value; + } + } + } +} diff --git a/LitleSdkForNet/LitleSdkForNet/Properties/Settings.settings b/LitleSdkForNet/LitleSdkForNet/Properties/Settings.settings index 29990f55..0b9d5dfa 100644 --- a/LitleSdkForNet/LitleSdkForNet/Properties/Settings.settings +++ b/LitleSdkForNet/LitleSdkForNet/Properties/Settings.settings @@ -1,63 +1,63 @@ - - - - - - Default Report Group - - - true - - - 500 - - - prelive.litle.com - - - C:\Litle\dll\knownhosts - - - dotnet - - - dotnet - - - prelive.litle.com - - - 15000 - - - C:\Litle\ - - - C:\Litle\ - - - null - - - true - - - https://www.testlitle.com/sandbox/communicator/online - - - - - - - - - dotnet - - - dotnet - - - 011 - - - + + + + + + Default Report Group + + + true + + + 500 + + + prelive.litle.com + + + C:\Litle\dll\knownhosts + + + dotnet + + + dotnet + + + prelive.litle.com + + + 15000 + + + C:\Litle\ + + + C:\Litle\ + + + null + + + true + + + https://prelive.litle.com/vap/communicator/online + + + + + + + + + dotnet + + + dotnet + + + 011 + + + \ No newline at end of file diff --git a/LitleSdkForNet/LitleSdkForNet/XmlRequestFields.cs b/LitleSdkForNet/LitleSdkForNet/XmlRequestFields.cs index 2d1d8b1b..8e2cf57e 100644 --- a/LitleSdkForNet/LitleSdkForNet/XmlRequestFields.cs +++ b/LitleSdkForNet/LitleSdkForNet/XmlRequestFields.cs @@ -1,3654 +1,3911 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Security; -using System.Xml.Serialization; - -namespace Litle.Sdk -{ - public partial class litleOnlineRequest - { - - public string merchantId; - public string merchantSdk; - public authentication authentication; - public authorization authorization; - public capture capture; - public credit credit; - public voidTxn voidTxn; - public sale sale; - public authReversal authReversal; - public echeckCredit echeckCredit; - public echeckVerification echeckVerification; - public echeckSale echeckSale; - public registerTokenRequestType registerTokenRequest; - public forceCapture forceCapture; - public captureGivenAuth captureGivenAuth; - public echeckRedeposit echeckRedeposit; - public echeckVoid echeckVoid; - public updateCardValidationNumOnToken updateCardValidationNumOnToken; - public updateSubscription updateSubscription; - public cancelSubscription cancelSubscription; - public activate activate; - public deactivate deactivate; - public load load; - public unload unload; - public balanceInquiry balanceInquiry; - public createPlan createPlan; - public updatePlan updatePlan; - public refundReversal refundReversal; - public loadReversal loadReversal; - public depositReversal depositReversal; - public activateReversal activateReversal; - public deactivateReversal deactivateReversal; - public unloadReversal unloadReversal; - - public string Serialize() - { - string xml = "\r\n" - + authentication.Serialize(); - - if (authorization != null) xml += authorization.Serialize(); - else if (capture != null) xml += capture.Serialize(); - else if (credit != null) xml += credit.Serialize(); - else if (voidTxn != null) xml += voidTxn.Serialize(); - else if (sale != null) xml += sale.Serialize(); - else if (authReversal != null) xml += authReversal.Serialize(); - else if (echeckCredit != null) xml += echeckCredit.Serialize(); - else if (echeckVerification != null) xml += echeckVerification.Serialize(); - else if (echeckSale != null) xml += echeckSale.Serialize(); - else if (registerTokenRequest != null) xml += registerTokenRequest.Serialize(); - else if (forceCapture != null) xml += forceCapture.Serialize(); - else if (captureGivenAuth != null) xml += captureGivenAuth.Serialize(); - else if (echeckRedeposit != null) xml += echeckRedeposit.Serialize(); - else if (echeckVoid != null) xml += echeckVoid.Serialize(); - else if (updateCardValidationNumOnToken != null) xml += updateCardValidationNumOnToken.Serialize(); - else if (updateSubscription != null) xml += updateSubscription.Serialize(); - else if (cancelSubscription != null) xml += cancelSubscription.Serialize(); - else if (activate != null) xml += activate.Serialize(); - else if (deactivate != null) xml += deactivate.Serialize(); - else if (load != null) xml += load.Serialize(); - else if (unload != null) xml += unload.Serialize(); - else if (balanceInquiry != null) xml += balanceInquiry.Serialize(); - else if (createPlan != null) xml += createPlan.Serialize(); - else if (updatePlan != null) xml += updatePlan.Serialize(); - else if (refundReversal != null) xml += refundReversal.Serialize(); - else if (loadReversal != null) xml += loadReversal.Serialize(); - else if (depositReversal != null) xml += depositReversal.Serialize(); - else if (activateReversal != null) xml += activateReversal.Serialize(); - else if (deactivateReversal != null) xml += deactivateReversal.Serialize(); - else if (unloadReversal != null) xml += unloadReversal.Serialize(); - xml += "\r\n"; - - return xml; - } - } - - - public partial class authentication - { - public string user; - public string password; - public String Serialize() - { - return "\r\n\r\n" + SecurityElement.Escape(user) + "\r\n" + SecurityElement.Escape(password) + "\r\n"; - } - } - - public partial class customerInfo - { - - public string ssn; - - public DateTime dob; - - public DateTime customerRegistrationDate; - - private customerInfoCustomerType customerTypeField; - private bool customerTypeSet; - public customerInfoCustomerType customerType - { - get { return this.customerTypeField; } - set { this.customerTypeField = value; customerTypeSet = true; } - } - - private long incomeAmountField; - private bool incomeAmountSet; - public long incomeAmount - { - get { return this.incomeAmountField; } - set { this.incomeAmountField = value; incomeAmountSet = true; } - } - - private currencyCodeEnum incomeCurrencyField; - private bool incomeCurrencySet; - public currencyCodeEnum incomeCurrency - { - get { return this.incomeCurrencyField; } - set { this.incomeCurrencyField = value; incomeCurrencySet = true; } - } - - private bool customerCheckingAccountField; - private bool customerCheckingAccountSet; - public bool customerCheckingAccount - { - get { return this.customerCheckingAccountField; } - set { this.customerCheckingAccountField = value; customerCheckingAccountSet = true; } - } - - private bool customerSavingAccountField; - private bool customerSavingAccountSet; - public bool customerSavingAccount - { - get { return this.customerSavingAccountField; } - set { this.customerSavingAccountField = value; customerSavingAccountSet = true; } - } - - public string employerName; - - public string customerWorkTelephone; - - private customerInfoResidenceStatus residenceStatusField; - private bool residenceStatusSet; - public customerInfoResidenceStatus residenceStatus - { - get { return this.residenceStatusField; } - set { this.residenceStatusField = value; residenceStatusSet = true; } - } - - private int yearsAtResidenceField; - private bool yearsAtResidenceSet; - public int yearsAtResidence - { - get { return this.yearsAtResidenceField; } - set { this.yearsAtResidenceField = value; yearsAtResidenceSet = true; } - } - - private int yearsAtEmployerField; - private bool yearsAtEmployerSet; - public int yearsAtEmployer - { - get - { - return this.yearsAtEmployerField; - } - set - { - this.yearsAtEmployerField = value; - this.yearsAtEmployerSet = true; - } - } - - - public customerInfo() - { - this.incomeCurrency = currencyCodeEnum.USD; - } - - public string Serialize() - { - string xml = ""; - if (ssn != null) - { - xml += "\r\n" + SecurityElement.Escape(ssn) + ""; - } - if (dob != null) - { - xml += "\r\n" + XmlUtil.toXsdDate(dob) + ""; - } - if (customerRegistrationDate != null) - { - xml += "\r\n" + XmlUtil.toXsdDate(customerRegistrationDate) + ""; - } - if (customerTypeSet) - { - xml += "\r\n" + customerTypeField + ""; - } - if (incomeAmountSet) - { - xml += "\r\n" + incomeAmountField + ""; - } - if (incomeCurrencySet) - { - xml += "\r\n" + incomeCurrencyField + ""; - } - if (customerCheckingAccountSet) - { - xml += "\r\n" + customerCheckingAccountField.ToString().ToLower() + ""; - } - if (customerSavingAccountSet) - { - xml += "\r\n" + customerSavingAccountField.ToString().ToLower() + ""; - } - if (employerName != null) - { - xml += "\r\n" + SecurityElement.Escape(employerName) + ""; - } - if (customerWorkTelephone != null) - { - xml += "\r\n" + SecurityElement.Escape(customerWorkTelephone) + ""; - } - if (residenceStatusSet) - { - xml += "\r\n" + residenceStatusField + ""; - } - if (yearsAtResidenceSet) - { - xml += "\r\n" + yearsAtResidenceField + ""; - } - if (yearsAtEmployerSet) - { - xml += "\r\n" + yearsAtEmployerField + ""; - } - return xml; - } - - - } - - public enum customerInfoCustomerType - { - - /// - New, - Existing, - } - - public enum currencyCodeEnum - { - - /// - AUD, - CAD, - CHF, - DKK, - EUR, - GBP, - HKD, - JPY, - NOK, - NZD, - SEK, - SGD, - USD, - } - - public enum customerInfoResidenceStatus - { - - /// - Own, - Rent, - Other, - } - - public partial class enhancedData - { - public string customerReference; - private long salesTaxField; - private bool salesTaxSet; - public long salesTax - { - get { return this.salesTaxField; } - set { this.salesTaxField = value; this.salesTaxSet = true; } - } - private enhancedDataDeliveryType deliveryTypeField; - private bool deliveryTypeSet; - public enhancedDataDeliveryType deliveryType - { - get { return this.deliveryTypeField; } - set { this.deliveryTypeField = value; this.deliveryTypeSet = true; } - } - public bool taxExemptField; - public bool taxExemptSet; - public bool taxExempt - { - get { return this.taxExemptField; } - set { this.taxExemptField = value; this.taxExemptSet = true; } - } - private long discountAmountField; - private bool discountAmountSet; - public long discountAmount - { - get { return this.discountAmountField; } - set { this.discountAmountField = value; this.discountAmountSet = true; } - } - private long shippingAmountField; - private bool shippingAmountSet; - public long shippingAmount - { - get { return this.shippingAmountField; } - set { this.shippingAmountField = value; this.shippingAmountSet = true; } - } - private long dutyAmountField; - private bool dutyAmountSet; - public long dutyAmount - { - get { return this.dutyAmountField; } - set { this.dutyAmountField = value; this.dutyAmountSet = true; } - } - public string shipFromPostalCode; - public string destinationPostalCode; - private countryTypeEnum destinationCountryCodeField; - private bool destinationCountryCodeSet; - public countryTypeEnum destinationCountry - { - get { return this.destinationCountryCodeField; } - set { this.destinationCountryCodeField = value; this.destinationCountryCodeSet = true; } - } - public string invoiceReferenceNumber; - private DateTime orderDateField; - private bool orderDateSet; - public DateTime orderDate - { - get { return this.orderDateField; } - set { this.orderDateField = value; this.orderDateSet = true; } - } - public List detailTaxes; - public List lineItems; - - public enhancedData() - { - lineItems = new List(); - detailTaxes = new List(); - } - - public string Serialize() - { - string xml = ""; - if (customerReference != null) xml += "\r\n" + SecurityElement.Escape(customerReference) + ""; - if (salesTaxSet) xml += "\r\n" + salesTaxField + ""; - if (deliveryTypeSet) xml += "\r\n" + deliveryTypeField + ""; - if (taxExemptSet) xml += "\r\n" + taxExemptField.ToString().ToLower() + ""; - if (discountAmountSet) xml += "\r\n" + discountAmountField + ""; - if (shippingAmountSet) xml += "\r\n" + shippingAmountField + ""; - if (dutyAmountSet) xml += "\r\n" + dutyAmountField + ""; - if (shipFromPostalCode != null) xml += "\r\n" + SecurityElement.Escape(shipFromPostalCode) + ""; - if (destinationPostalCode != null) xml += "\r\n" + SecurityElement.Escape(destinationPostalCode) + ""; - if (destinationCountryCodeSet) xml += "\r\n" + destinationCountryCodeField + ""; - if (invoiceReferenceNumber != null) xml += "\r\n" + SecurityElement.Escape(invoiceReferenceNumber) + ""; - if (orderDateSet) xml += "\r\n" + XmlUtil.toXsdDate(orderDateField) + ""; - foreach (detailTax detailTax in detailTaxes) - { - xml += "\r\n" + detailTax.Serialize() + "\r\n"; - } - foreach (lineItemData lineItem in lineItems) - { - xml += "\r\n" + lineItem.Serialize() + "\r\n"; - } - return xml; - } - } - - public partial class voidTxn : transactionTypeWithReportGroup - { - public long litleTxnId; - public processingInstructions processingInstructions; - - public override string Serialize() - { - string xml = "\r\n"; - if (processingInstructions != null) xml += "\r\n" + processingInstructions.Serialize() + "\r\n"; - xml += "\r\n"; - - return xml; - } - - } - - public partial class lineItemData - { - private int itemSeqenceNumberField; - private bool itemSequenceNumberSet; - public int itemSequenceNumber - { - get { return this.itemSeqenceNumberField; } - set { this.itemSeqenceNumberField = value; this.itemSequenceNumberSet = true; } - } - public string itemDescription; - public string productCode; - public string quantity; - public string unitOfMeasure; - private long taxAmountField; - private bool taxAmountSet; - public long taxAmount - { - get { return this.taxAmountField; } - set { this.taxAmountField = value; this.taxAmountSet = true; } - } - private long lineItemTotalField; - private bool lineItemTotalSet; - public long lineItemTotal - { - get { return this.lineItemTotalField; } - set { this.lineItemTotalField = value; this.lineItemTotalSet = true; } - } - private long lineItemTotalWithTaxField; - private bool lineItemTotalWithTaxSet; - public long lineItemTotalWithTax - { - get { return this.lineItemTotalWithTaxField; } - set { this.lineItemTotalWithTaxField = value; this.lineItemTotalWithTaxSet = true; } - } - private long itemDiscountAmountField; - private bool itemDiscountAmountSet; - public long itemDiscountAmount - { - get { return this.itemDiscountAmountField; } - set { this.itemDiscountAmountField = value; this.itemDiscountAmountSet = true; } - } - public string commodityCode; - public string unitCost; - public List detailTaxes; - - public lineItemData() - { - detailTaxes = new List(); - } - - public string Serialize() - { - string xml = ""; - if (itemSequenceNumberSet) xml += "\r\n" + itemSeqenceNumberField + ""; - if (itemDescription != null) xml += "\r\n" + SecurityElement.Escape(itemDescription) + ""; - if (productCode != null) xml += "\r\n" + SecurityElement.Escape(productCode) + ""; - if (quantity != null) xml += "\r\n" + SecurityElement.Escape(quantity) + ""; - if (unitOfMeasure != null) xml += "\r\n" + SecurityElement.Escape(unitOfMeasure) + ""; - if (taxAmountSet) xml += "\r\n" + taxAmountField + ""; - if (lineItemTotalSet) xml += "\r\n" + lineItemTotalField + ""; - if (lineItemTotalWithTaxSet) xml += "\r\n" + lineItemTotalWithTaxField + ""; - if (itemDiscountAmountSet) xml += "\r\n" + itemDiscountAmountField + ""; - if (commodityCode != null) xml += "\r\n" + SecurityElement.Escape(commodityCode) + ""; - if (unitCost != null) xml += "\r\n" + SecurityElement.Escape(unitCost) + ""; - foreach (detailTax detailTax in detailTaxes) - { - if (detailTax != null) xml += "\r\n" + detailTax.Serialize() + ""; - } - return xml; - } - - } - - - public partial class detailTax - { - private bool taxIncludedInTotalField; - private bool taxIncludedInTotalSet; - public bool taxIncludedInTotal - { - get { return this.taxIncludedInTotalField; } - set { this.taxIncludedInTotalField = value; this.taxIncludedInTotalSet = true; } - } - private long taxAmountField; - private bool taxAmountSet; - public long taxAmount - { - get { return this.taxAmountField; } - set { this.taxAmountField = value; this.taxAmountSet = true; } - } - public string taxRate; - private taxTypeIdentifierEnum taxTypeIdentifierField; - private bool taxTypeIdentifierSet; - public taxTypeIdentifierEnum taxTypeIdentifier - { - get { return this.taxTypeIdentifierField; } - set { this.taxTypeIdentifierField = value; this.taxTypeIdentifierSet = true; } - } - public string cardAcceptorTaxId; - - public string Serialize() - { - string xml = ""; - if (taxIncludedInTotalSet) xml += "\r\n" + taxIncludedInTotalField.ToString().ToLower() + ""; - if (taxAmountSet) xml += "\r\n" + taxAmountField + ""; - if (taxRate != null) xml += "\r\n" + SecurityElement.Escape(taxRate) + ""; - if (taxTypeIdentifierSet) xml += "\r\n" + taxTypeIdentifierField + ""; - if (cardAcceptorTaxId != null) xml += "\r\n" + SecurityElement.Escape(cardAcceptorTaxId) + ""; - return xml; - } - } - - public partial class transactionTypeWithReportGroupAndPartial : transactionType - { - public string reportGroup; - private bool partialField; - protected bool partialSet; - public bool partial - { - get { return this.partialField; } - set { this.partialField = value; partialSet = true; } - } - } - - public partial class capture : transactionTypeWithReportGroupAndPartial - { - public long litleTxnId; - private long amountField; - private bool amountSet; - public long amount - { - get { return this.amountField; } - set { this.amountField = value; amountSet = true; } - } - private bool surchargeAmountSet; - private long surchargeAmountField; - public long surchargeAmount - { - get { return this.surchargeAmountField; } - set { this.surchargeAmountField = value; this.surchargeAmountSet = true; } - } - public enhancedData enhancedData; - public processingInstructions processingInstructions; - private bool payPalOrderCompleteField; - private bool payPalOrderCompleteSet; - public bool payPalOrderComplete - { - get { return this.payPalOrderCompleteField; } - set { this.payPalOrderCompleteField = value; payPalOrderCompleteSet = true; } - } - public string payPalNotes; - - public override string Serialize() - { - string xml = "\r\n"; - if (amountSet) xml += "\r\n" + amountField + ""; - if (surchargeAmountSet) xml += "\r\n" + surchargeAmountField + ""; - if (enhancedData != null) xml += "\r\n" + enhancedData.Serialize() + "\r\n"; - if (processingInstructions != null) xml += "\r\n" + processingInstructions.Serialize() + "\r\n"; - if (payPalOrderCompleteSet) xml += "\r\n" + payPalOrderCompleteField.ToString().ToLower() + ""; - if (payPalNotes != null) xml += "\r\n" + SecurityElement.Escape(payPalNotes) + ""; - xml += "\r\n"; - - return xml; - } - } - - public partial class echeckCredit : transactionTypeWithReportGroup - { - private long litleTxnIdField; - private bool litleTxnIdSet; - public long litleTxnId - { - get { return this.litleTxnIdField; } - set { this.litleTxnIdField = value; litleTxnIdSet = true; } - } - private long amountField; - private bool amountSet; - public long amount - { - get { return this.amountField; } - set { this.amountField = value; amountSet = true; } - } - private bool secondaryAmountSet; - private long secondaryAmountField; - public long secondaryAmount - { - get { return this.secondaryAmountField; } - set { this.secondaryAmountField = value; this.secondaryAmountSet = true; } - } - public customBilling customBilling; - public string orderId; - public orderSourceType orderSource; - public contact billToAddress; - public echeckType echeck; - - [Obsolete()] - public echeckTokenType token - { - get { return echeckToken; } - set { echeckToken = value; } - } - - public echeckTokenType echeckToken; - - public merchantDataType merchantData; - - public override string Serialize() - { - string xml = "\r\n"; - if (amountSet) xml += "\r\n" + amountField + ""; - if (secondaryAmountSet) xml += "\r\n" + secondaryAmountField + ""; - if (customBilling != null) xml += "\r\n" + customBilling.Serialize() + ""; - } - else - { - xml += "\r\n" + SecurityElement.Escape(orderId) + ""; - xml += "\r\n" + amountField + ""; - if (secondaryAmountSet) xml += "\r\n" + secondaryAmountField + ""; - if (orderSource != null) xml += "\r\n" + orderSource.Serialize() + ""; - if (billToAddress != null) xml += "\r\n" + billToAddress.Serialize() + ""; - if (echeck != null) xml += "\r\n" + echeck.Serialize() + ""; - else if (echeckToken != null) xml += "\r\n" + echeckToken.Serialize() + ""; - if (customBilling != null) xml += "\r\n" + customBilling.Serialize() + ""; - if (merchantData != null) xml += "\r\n" + merchantData.Serialize() + ""; - } - xml += "\r\n"; - return xml; - } - } - - public partial class echeckSale : transactionTypeWithReportGroup - { - private long litleTxnIdField; - private bool litleTxnIdSet; - public long litleTxnId - { - get { return this.litleTxnIdField; } - set { this.litleTxnIdField = value; litleTxnIdSet = true; } - } - private long amountField; - private bool amountSet; - public long amount - { - get { return this.amountField; } - set { this.amountField = value; amountSet = true; } - } - private bool secondaryAmountSet; - private long secondaryAmountField; - public long secondaryAmount - { - get { return this.secondaryAmountField; } - set { this.secondaryAmountField = value; this.secondaryAmountSet = true; } - } - public customBilling customBilling; - public string orderId; - private bool verifyField; - private bool verifySet; - public bool verify - { - get { return this.verifyField; } - set { this.verifyField = value; verifySet = true; } - } - public orderSourceType orderSource; - public contact billToAddress; - public contact shipToAddress; - public echeckType echeck; - public echeckTokenType token; - public merchantDataType merchantData; - - public override string Serialize() - { - string xml = "\r\n"; - if (amountSet) xml += "\r\n" + amountField + ""; - // let sandbox do the validation for secondaryAmount - if (secondaryAmountSet) xml += "\r\n" + secondaryAmountField + ""; - if (customBilling != null) xml += "\r\n" + customBilling.Serialize() + ""; - } - else - { - xml += "\r\n" + SecurityElement.Escape(orderId) + ""; - if (verifySet) xml += "\r\n" + (verifyField ? "true" : "false") + ""; - xml += "\r\n" + amountField + ""; - if (secondaryAmountSet) xml += "\r\n" + secondaryAmountField + ""; - if (orderSource != null) xml += "\r\n" + orderSource.Serialize() + ""; - if (billToAddress != null) xml += "\r\n" + billToAddress.Serialize() + ""; - if (shipToAddress != null) xml += "\r\n" + shipToAddress.Serialize() + ""; - if (echeck != null) xml += "\r\n" + echeck.Serialize() + ""; - else if (token != null) xml += "\r\n" + token.Serialize() + ""; - if (customBilling != null) xml += "\r\n" + customBilling.Serialize() + ""; - if (merchantData != null) xml += "\r\n" + merchantData.Serialize() + ""; - } - xml += "\r\n"; - return xml; - } - } - - - public partial class echeckVerification : transactionTypeWithReportGroup - { - private long litleTxnIdField; - private bool litleTxnIdSet; - public long litleTxnId - { - get { return this.litleTxnIdField; } - set { this.litleTxnIdField = value; litleTxnIdSet = true; } - } - public string orderId; - private long amountField; - private bool amountSet; - public long amount - { - get { return this.amountField; } - set { this.amountField = value; amountSet = true; } - } - public orderSourceType orderSource; - public contact billToAddress; - public echeckType echeck; - public echeckTokenType token; - public merchantDataType merchantData; - - public override string Serialize() - { - string xml = "\r\n"; - xml += "\r\n" + orderId + ""; - if (amountSet) xml += "\r\n" + amountField + ""; - if (orderSource != null) xml += "\r\n" + orderSource.Serialize() + ""; - if (billToAddress != null) xml += "\r\n" + billToAddress.Serialize() + ""; - if (echeck != null) xml += "\r\n" + echeck.Serialize() + ""; - else if (token != null) xml += "\r\n" + token.Serialize() + ""; - if (merchantData != null) xml += "\r\n" + merchantData.Serialize() + ""; - xml += "\r\n"; - return xml; - } - } - - public partial class registerTokenRequestType : transactionTypeWithReportGroup - { - public string orderId; - public string accountNumber; - public echeckForTokenType echeckForToken; - public string paypageRegistrationId; - public string cardValidationNum; - public applepayType applepay; - - public override string Serialize() - { - string xml = "\r\n"; - if (accountNumber != null) xml += "\r\n" + accountNumber + ""; - else if (echeckForToken != null) xml += "\r\n" + echeckForToken.Serialize() + ""; - else if (paypageRegistrationId != null) xml += "\r\n" + paypageRegistrationId + ""; - else if (applepay != null) xml += "\r\n" + applepay.Serialize() + "\r\n"; - if (cardValidationNum != null) xml += "\r\n" + cardValidationNum + ""; - xml += "\r\n"; - return xml; - } - } - - public partial class updateCardValidationNumOnToken : transactionTypeWithReportGroup - { - public string orderId; - public string litleToken; - public string cardValidationNum; - - public override string Serialize() - { - string xml = "\r\n"; - if (litleToken != null) xml += "\r\n" + SecurityElement.Escape(litleToken) + ""; - if (cardValidationNum != null) xml += "\r\n" + SecurityElement.Escape(cardValidationNum) + ""; - xml += "\r\n"; - return xml; - } - } - - public partial class echeckForTokenType - { - public string accNum; - public string routingNum; - - public string Serialize() - { - string xml = ""; - if (accNum != null) xml += "\r\n" + SecurityElement.Escape(accNum) + ""; - if (routingNum != null) xml += "\r\n" + SecurityElement.Escape(routingNum) + ""; - return xml; - } - } - - - public partial class credit : transactionTypeWithReportGroup - { - private long litleTxnIdField; - private bool litleTxnIdSet; - public long litleTxnId - { - get { return this.litleTxnIdField; } - set { this.litleTxnIdField = value; litleTxnIdSet = true; } - } - private long amountField; - private bool amountSet; - public long amount - { - get { return this.amountField; } - set { this.amountField = value; amountSet = true; } - } - private bool secondaryAmountSet; - private long secondaryAmountField; - public long secondaryAmount - { - get { return this.secondaryAmountField; } - set { this.secondaryAmountField = value; this.secondaryAmountSet = true; } - } - private bool surchargeAmountSet; - private long surchargeAmountField; - public long surchargeAmount - { - get { return this.surchargeAmountField; } - set { this.surchargeAmountField = value; this.surchargeAmountSet = true; } - } - public customBilling customBilling; - public enhancedData enhancedData; - public processingInstructions processingInstructions; - public string orderId; - public orderSourceType orderSource; - public contact billToAddress; - public cardType card; - public mposType mpos; - public cardTokenType token; - public cardPaypageType paypage; - public payPal paypal; - private taxTypeIdentifierEnum taxTypeField; - private bool taxTypeSet; - public taxTypeIdentifierEnum taxType - { - get { return this.taxTypeField; } - set { this.taxTypeField = value; taxTypeSet = true; } - } - public billMeLaterRequest billMeLaterRequest; - public pos pos; - public amexAggregatorData amexAggregatorData; - public merchantDataType merchantData; - public String payPalNotes; - public String actionReason; - - public override string Serialize() - { - string xml = "\r\n"; - if (amountSet) xml += "\r\n" + amountField + ""; - if (secondaryAmountSet) xml += "\r\n" + secondaryAmountField + ""; - if (surchargeAmountSet) xml += "\r\n" + surchargeAmountField + ""; - if (customBilling != null) xml += "\r\n" + customBilling.Serialize() + ""; - if (enhancedData != null) xml += "\r\n" + enhancedData.Serialize() + ""; - if (processingInstructions != null) xml += "\r\n" + processingInstructions.Serialize() + ""; - if (pos != null) xml += "\r\n" + pos.Serialize() + ""; - } - else - { - xml += "\r\n" + SecurityElement.Escape(orderId) + ""; - xml += "\r\n" + amountField + ""; - if (secondaryAmountSet) xml += "\r\n" + secondaryAmountField + ""; - if (surchargeAmountSet) xml += "\r\n" + surchargeAmountField + ""; - if (orderSource != null) xml += "\r\n" + orderSource.Serialize() + ""; - if (billToAddress != null) xml += "\r\n" + billToAddress.Serialize() + ""; - if (card != null) xml += "\r\n" + card.Serialize() + ""; - else if (token != null) xml += "\r\n" + token.Serialize() + ""; - else if (mpos != null) xml += "\r\n" + mpos.Serialize() + ""; - else if (paypage != null) xml += "\r\n" + paypage.Serialize() + ""; - else if (paypal != null) - { - xml += "\r\n"; - if (paypal.payerId != null) xml += "\r\n" + SecurityElement.Escape(paypal.payerId) + ""; - else if (paypal.payerEmail != null) xml += "\r\n" + SecurityElement.Escape(paypal.payerEmail) + ""; - xml += "\r\n"; - } - if (customBilling != null) xml += "\r\n" + customBilling.Serialize() + ""; - if (taxTypeSet) xml += "\r\n" + taxTypeField + ""; - if (billMeLaterRequest != null) xml += "\r\n" + billMeLaterRequest.Serialize() + ""; - if (enhancedData != null) xml += "\r\n" + enhancedData.Serialize() + ""; - if (processingInstructions != null) xml += "\r\n" + processingInstructions.Serialize() + ""; - if (pos != null) xml += "\r\n" + pos.Serialize() + ""; - if (amexAggregatorData != null) xml += "\r\n" + amexAggregatorData.Serialize() + ""; - if (merchantData != null) xml += "\r\n" + merchantData.Serialize() + ""; - } - if (payPalNotes != null) xml += "\r\n" + SecurityElement.Escape(payPalNotes) + ""; - if (actionReason != null) xml += "\r\n" + SecurityElement.Escape(actionReason) + ""; - xml += "\r\n"; - return xml; - } - } - - public partial class echeckType - { - private echeckAccountTypeEnum accTypeField; - private bool accTypeSet; - public echeckAccountTypeEnum accType - { - get { return this.accTypeField; } - set { this.accTypeField = value; accTypeSet = true; } - } - - public string accNum; - public string routingNum; - public string checkNum; - public string ccdPaymentInformation; - - public string Serialize() - { - string xml = ""; - string accTypeName = accTypeField.ToString(); - XmlEnumAttribute[] attributes = - (XmlEnumAttribute[])typeof(echeckAccountTypeEnum).GetMember(accTypeField.ToString())[0].GetCustomAttributes(typeof(XmlEnumAttribute), false); - if (attributes.Length > 0) accTypeName = attributes[0].Name; - if (accTypeSet) xml += "\r\n" + accTypeName + ""; - if (accNum != null) xml += "\r\n" + SecurityElement.Escape(accNum) + ""; - if (routingNum != null) xml += "\r\n" + SecurityElement.Escape(routingNum) + ""; - if (checkNum != null) xml += "\r\n" + SecurityElement.Escape(checkNum) + ""; - if (ccdPaymentInformation != null) xml += "\r\n" + SecurityElement.Escape(ccdPaymentInformation) + ""; - return xml; - } - } - - public partial class echeckTokenType - { - public string litleToken; - public string routingNum; - private echeckAccountTypeEnum accTypeField; - private bool accTypeSet; - public echeckAccountTypeEnum accType - { - get { return this.accTypeField; } - set { this.accTypeField = value; accTypeSet = true; } - } - public string checkNum; - - public string Serialize() - { - string xml = ""; - if (litleToken != null) xml += "\r\n" + SecurityElement.Escape(litleToken) + ""; - if (routingNum != null) xml += "\r\n" + SecurityElement.Escape(routingNum) + ""; - if (accTypeSet) xml += "\r\n" + accTypeField + ""; - if (checkNum != null) xml += "\r\n" + SecurityElement.Escape(checkNum) + ""; - return xml; - } - - } - - - public partial class pos - { - private posCapabilityTypeEnum capabilityField; - private bool capabilitySet; - public posCapabilityTypeEnum capability - { - get { return this.capabilityField; } - set { this.capabilityField = value; capabilitySet = true; } - } - - private posEntryModeTypeEnum entryModeField; - private bool entryModeSet; - public posEntryModeTypeEnum entryMode - { - get { return this.entryModeField; } - set { this.entryModeField = value; entryModeSet = true; } - } - - private posCardholderIdTypeEnum cardholderIdField; - private bool cardholderIdSet; - public posCardholderIdTypeEnum cardholderId - { - get { return this.cardholderIdField; } - set { this.cardholderIdField = value; cardholderIdSet = true; } - } - public string terminalId; - - private posCatLevelEnum catLevelField; - private bool catLevelSet; - public posCatLevelEnum catLevel - { - get { return this.catLevelField; } - set { this.catLevelField = value; catLevelSet = true; } - } - - public string Serialize() - { - string xml = ""; - if (capabilitySet) xml += "\r\n" + capabilityField + ""; - if (entryModeSet) xml += "\r\n" + entryModeField + ""; - if (cardholderIdSet) xml += "\r\n" + cardholderIdField + ""; - if (terminalId != null) xml += "\r\n" + SecurityElement.Escape(terminalId) + ""; - if (catLevelSet) xml += "\r\n" + catLevelField.Serialize() +""; - return xml; - } - - } - - public partial class payPal - { - public string payerId; - public string payerEmail; - public string token; - public string transactionId; - - public string Serialize() - { - string xml = ""; - if (payerId != null) xml += "\r\n" + SecurityElement.Escape(payerId) + ""; - if (payerEmail != null) xml += "\r\n" + SecurityElement.Escape(payerEmail) + ""; - if (token != null) xml += "\r\n" + SecurityElement.Escape(token) + ""; - if (transactionId != null) xml += "\r\n" + SecurityElement.Escape(transactionId) + ""; - return xml; - } - } - - public partial class merchantDataType - { - public string campaign; - public string affiliate; - public string merchantGroupingId; - - public string Serialize() - { - string xml = ""; - if (campaign != null) xml += "\r\n" + SecurityElement.Escape(campaign) + ""; - if (affiliate != null) xml += "\r\n" + SecurityElement.Escape(affiliate) + ""; - if (merchantGroupingId != null) xml += "\r\n" + SecurityElement.Escape(merchantGroupingId) + ""; - return xml; - } - } - - public partial class cardTokenType - { - public string litleToken; - public string expDate; - public string cardValidationNum; - private methodOfPaymentTypeEnum typeField; - private bool typeSet; - public methodOfPaymentTypeEnum type - { - get { return this.typeField; } - set { this.typeField = value; typeSet = true; } - } - - public string Serialize() - { - string xml = "\r\n" + SecurityElement.Escape(litleToken) + ""; - if (expDate != null) xml += "\r\n" + SecurityElement.Escape(expDate) + ""; - if (cardValidationNum != null) xml += "\r\n" + SecurityElement.Escape(cardValidationNum) + ""; - if (typeSet) xml += "\r\n" + methodOfPaymentSerializer.Serialize(typeField) + ""; - return xml; - } - } - - public partial class cardPaypageType - { - public string paypageRegistrationId; - public string expDate; - public string cardValidationNum; - private methodOfPaymentTypeEnum typeField; - private bool typeSet; - public methodOfPaymentTypeEnum type - { - get { return this.typeField; } - set { this.typeField = value; typeSet = true; } - } - - public string Serialize() - { - string xml = "\r\n" + SecurityElement.Escape(paypageRegistrationId) + ""; - if (expDate != null) xml += "\r\n" + SecurityElement.Escape(expDate) + ""; - if (cardValidationNum != null) xml += "\r\n" + SecurityElement.Escape(cardValidationNum) + ""; - if (typeSet) xml += "\r\n" + methodOfPaymentSerializer.Serialize(typeField) + ""; - return xml; - } - } - - public partial class billMeLaterRequest - { - private long bmlMerchantIdField; - private bool bmlMerchantIdSet; - public long bmlMerchantId - { - get { return this.bmlMerchantIdField; } - set { this.bmlMerchantIdField = value; bmlMerchantIdSet = true; } - } - private long bmlProductTypeField; - private bool bmlProductTypeSet; - public long bmlProductType - { - get { return this.bmlProductTypeField; } - set { this.bmlProductTypeField = value; bmlProductTypeSet = true; } - } - private int termsAndConditionsField; - private bool termsAndConditionsSet; - public int termsAndConditions - { - get { return this.termsAndConditionsField; } - set { this.termsAndConditionsField = value; termsAndConditionsSet = true; } - } - public string preapprovalNumber; - private int merchantPromotionalCodeField; - private bool merchantPromotionalCodeSet; - public int merchantPromotionalCode - { - get { return this.merchantPromotionalCodeField; } - set { this.merchantPromotionalCodeField = value; merchantPromotionalCodeSet = true; } - } - public string virtualAuthenticationKeyPresenceIndicator; - public string virtualAuthenticationKeyData; - private int itemCategoryCodeField; - private bool itemCategoryCodeSet; - public int itemCategoryCode - { - get { return this.itemCategoryCodeField; } - set { this.itemCategoryCodeField = value; itemCategoryCodeSet = true; } - } - - public string Serialize() - { - string xml = ""; - if (bmlMerchantIdSet) xml += "\r\n" + bmlMerchantIdField + ""; - if (bmlProductTypeSet) xml += "\r\n" + bmlProductTypeField + ""; - if (termsAndConditionsSet) xml += "\r\n" + termsAndConditionsField + ""; - if (preapprovalNumber != null) xml += "\r\n" + SecurityElement.Escape(preapprovalNumber) + ""; - if (merchantPromotionalCodeSet) xml += "\r\n" + merchantPromotionalCodeField + ""; - if (virtualAuthenticationKeyPresenceIndicator != null) xml += "\r\n" + SecurityElement.Escape(virtualAuthenticationKeyPresenceIndicator) + ""; - if (virtualAuthenticationKeyData != null) xml += "\r\n" + SecurityElement.Escape(virtualAuthenticationKeyData) + ""; - if (itemCategoryCodeSet) xml += "\r\n" + itemCategoryCodeField + ""; - return xml; - } - - } - - public partial class customBilling - { - public string phone; - public string city; - public string url; - public string descriptor; - public string Serialize() - { - string xml = ""; - if (phone != null) xml += "\r\n" + SecurityElement.Escape(phone) + ""; - else if (city != null) xml += "\r\n" + SecurityElement.Escape(city) + ""; - else if (url != null) xml += "\r\n" + SecurityElement.Escape(url) + ""; - if (descriptor != null) xml += "\r\n" + SecurityElement.Escape(descriptor) + ""; - return xml; - } - } - - public partial class amexAggregatorData - { - public string sellerId; - public string sellerMerchantCategoryCode; - public string Serialize() - { - string xml = ""; - xml += "\r\n" + SecurityElement.Escape(sellerId) + ""; - xml += "\r\n" + SecurityElement.Escape(sellerMerchantCategoryCode) + ""; - return xml; - } - - } - - public partial class processingInstructions - { - private bool bypassVelocityCheckField; - private bool bypassVelocityCheckSet; - public bool bypassVelocityCheck - { - get { return this.bypassVelocityCheckField; } - set { this.bypassVelocityCheckField = value; this.bypassVelocityCheckSet = true; } - } - - public string Serialize() - { - string xml = ""; - if (bypassVelocityCheckSet) xml += "\r\n" + bypassVelocityCheckField.ToString().ToLower() + ""; - return xml; - } - } - - public partial class echeckRedeposit : baseRequestTransactionEcheckRedeposit - { - //litleTxnIdField and set are in super - public echeckType echeck; - public echeckTokenType token; - public merchantDataType merchantData; - - public override string Serialize() - { - string xml = "\r\n"; - if (litleTxnIdSet) xml += "\r\n" + litleTxnIdField + ""; - if (echeck != null) xml += "\r\n" + echeck.Serialize() + ""; - else if (token != null) xml += "\r\n" + token.Serialize() + ""; - if (merchantData != null) { xml += "\r\n" + merchantData.Serialize() + "\r\n"; } - xml += "\r\n"; - return xml; - } - } - - public partial class authorization : transactionTypeWithReportGroup - { - - private long litleTxnIdField; - private bool litleTxnIdSet; - public long litleTxnId - { - get - { - return this.litleTxnIdField; - } - set - { - this.litleTxnIdField = value; - this.litleTxnIdSet = true; - } - } - public string orderId; - public long amount; - private bool secondaryAmountSet; - private long secondaryAmountField; - public long secondaryAmount - { - get { return this.secondaryAmountField; } - set { this.secondaryAmountField = value; this.secondaryAmountSet = true; } - } - private bool surchargeAmountSet; - private long surchargeAmountField; - public long surchargeAmount - { - get { return this.surchargeAmountField; } - set { this.surchargeAmountField = value; this.surchargeAmountSet = true; } - } - public orderSourceType orderSource; - public customerInfo customerInfo; - public contact billToAddress; - public contact shipToAddress; - public cardType card; - public mposType mpos; - public payPal paypal; - public cardTokenType token; - public cardPaypageType paypage; - public applepayType applepay; - public billMeLaterRequest billMeLaterRequest; - public fraudCheckType cardholderAuthentication; - public processingInstructions processingInstructions; - public pos pos; - public customBilling customBilling; - private govtTaxTypeEnum taxTypeField; - private bool taxTypeSet; - public govtTaxTypeEnum taxType - { - get { return this.taxTypeField; } - set { this.taxTypeField = value; this.taxTypeSet = true; } - } - public enhancedData enhancedData; - public amexAggregatorData amexAggregatorData; - private bool allowPartialAuthField; - private bool allowPartialAuthSet; - public bool allowPartialAuth - { - get - { - return this.allowPartialAuthField; - } - set - { - this.allowPartialAuthField = value; - this.allowPartialAuthSet = true; - } - } - public healthcareIIAS healthcareIIAS; - public filteringType filtering; - public merchantDataType merchantData; - public recyclingRequestType recyclingRequest; - private bool fraudFilterOverrideField; - private bool fraudFilterOverrideSet; - public bool fraudFilterOverride - { - get - { - return this.fraudFilterOverrideField; - } - set - { - this.fraudFilterOverrideField = value; - this.fraudFilterOverrideSet = true; - } - } - public recurringRequest recurringRequest; - private bool debtRepaymentField; - private bool debtRepaymentSet; - public bool debtRepayment - { - get - { - return this.debtRepaymentField; - } - set - { - this.debtRepaymentField = value; - this.debtRepaymentSet = true; - } - } - public advancedFraudChecksType advancedFraudChecks; - public wallet wallet; - - public override String Serialize() - { - string xml = "\r\n"; - if (litleTxnIdSet) - { - xml += "\r\n" + litleTxnIdField + ""; - } - else - { - xml += "\r\n" + SecurityElement.Escape(orderId) + ""; - xml += "\r\n" + amount + ""; - if (secondaryAmountSet) xml += "\r\n" + secondaryAmountField + ""; - if (surchargeAmountSet) xml += "\r\n" + surchargeAmountField + ""; - if (orderSource != null) xml += "\r\n" + orderSource.Serialize() + ""; - - if (customerInfo != null) - { - xml += "\r\n" + customerInfo.Serialize() + "\r\n"; - } - if (billToAddress != null) - { - xml += "\r\n" + billToAddress.Serialize() + "\r\n"; - } - if (shipToAddress != null) - { - xml += "\r\n" + shipToAddress.Serialize() + "\r\n"; - } - if (card != null) - { - xml += "\r\n" + card.Serialize() + "\r\n"; - } - else if (paypal != null) - { - xml += "\r\n" + paypal.Serialize() + "\r\n"; - } - else if (mpos != null) - { - xml += "\r\n" + mpos.Serialize() + "\r\n"; - } - else if (token != null) - { - xml += "\r\n" + token.Serialize() + "\r\n"; - } - else if (paypage != null) - { - xml += "\r\n" + paypage.Serialize() + "\r\n"; - } - else if (applepay != null) - { - xml += "\r\n" + applepay.Serialize() + "\r\n"; - } - if (billMeLaterRequest != null) - { - xml += "\r\n" + billMeLaterRequest.Serialize() + "\r\n"; - } - if (cardholderAuthentication != null) - { - xml += "\r\n" + cardholderAuthentication.Serialize() + "\r\n"; - } - if (processingInstructions != null) - { - xml += "\r\n" + processingInstructions.Serialize() + "\r\n"; - } - if (pos != null) - { - xml += "\r\n" + pos.Serialize() + "\r\n"; - } - if (customBilling != null) - { - xml += "\r\n" + customBilling.Serialize() + "\r\n"; - } - if (taxTypeSet) - { - xml += "\r\n" + taxTypeField + ""; - } - if (enhancedData != null) - { - xml += "\r\n" + enhancedData.Serialize() + "\r\n"; - } - if (amexAggregatorData != null) - { - xml += "\r\n" + amexAggregatorData.Serialize() + "\r\n"; - } - if (allowPartialAuthSet) - { - xml += "\r\n" + allowPartialAuthField.ToString().ToLower() + ""; - } - if (healthcareIIAS != null) - { - xml += "\r\n" + healthcareIIAS.Serialize() + "\r\n"; - } - if (filtering != null) - { - xml += "\r\n" + filtering.Serialize() + "\r\n"; - } - if (merchantData != null) - { - xml += "\r\n" + merchantData.Serialize() + "\r\n"; - } - if (recyclingRequest != null) - { - xml += "\r\n" + recyclingRequest.Serialize() + "\r\n"; - } - if (fraudFilterOverrideSet) xml += "\r\n" + fraudFilterOverrideField.ToString().ToLower() + ""; - if (recurringRequest != null) - { - xml += "\r\n" + recurringRequest.Serialize() + "\r\n"; - } - if (debtRepaymentSet) xml += "\r\n" + debtRepayment.ToString().ToLower() + ""; - if (advancedFraudChecks != null) - { - xml += "\r\n" + advancedFraudChecks.Serialize() + "\r\n"; - } - if (wallet != null) - { - xml += "\r\n" + wallet.Serialize() + "\r\n"; - } - } - - xml += "\r\n"; - return xml; - } - } - - public partial class sale : transactionTypeWithReportGroup - { - - private long litleTxnIdField; - private bool litleTxnIdSet; - public long litleTxnId - { - get - { - return this.litleTxnIdField; - } - set - { - this.litleTxnIdField = value; - this.litleTxnIdSet = true; - } - } - public string orderId; - public long amount; - private bool secondaryAmountSet; - private long secondaryAmountField; - public long secondaryAmount - { - get { return this.secondaryAmountField; } - set { this.secondaryAmountField = value; this.secondaryAmountSet = true; } - } - private bool surchargeAmountSet; - private long surchargeAmountField; - public long surchargeAmount - { - get { return this.surchargeAmountField; } - set { this.surchargeAmountField = value; this.surchargeAmountSet = true; } - } - public orderSourceType orderSource; - public customerInfo customerInfo; - public contact billToAddress; - public contact shipToAddress; - public cardType card; - public mposType mpos; - public payPal paypal; - public cardTokenType token; - public cardPaypageType paypage; - public applepayType applepay; - public billMeLaterRequest billMeLaterRequest; - public fraudCheckType cardholderAuthentication; - public customBilling customBilling; - private govtTaxTypeEnum taxTypeField; - private bool taxTypeSet; - public govtTaxTypeEnum taxType - { - get { return this.taxTypeField; } - set { this.taxTypeField = value; this.taxTypeSet = true; } - } - public enhancedData enhancedData; - public processingInstructions processingInstructions; - public pos pos; - private bool payPalOrderCompleteField; - private bool payPalOrderCompleteSet; - public bool payPalOrderComplete - { - get { return this.payPalOrderCompleteField; } - set { this.payPalOrderCompleteField = value; this.payPalOrderCompleteSet = true; } - } - public string payPalNotes; - public amexAggregatorData amexAggregatorData; - private bool allowPartialAuthField; - private bool allowPartialAuthSet; - public bool allowPartialAuth - { - get - { - return this.allowPartialAuthField; - } - set - { - this.allowPartialAuthField = value; - this.allowPartialAuthSet = true; - } - } - public healthcareIIAS healthcareIIAS; - public filteringType filtering; - public merchantDataType merchantData; - public recyclingRequestType recyclingRequest; - private bool fraudFilterOverrideField; - private bool fraudFilterOverrideSet; - public bool fraudFilterOverride - { - get - { - return this.fraudFilterOverrideField; - } - set - { - this.fraudFilterOverrideField = value; - this.fraudFilterOverrideSet = true; - } - } - public recurringRequest recurringRequest; - public litleInternalRecurringRequest litleInternalRecurringRequest; - private bool debtRepaymentField; - private bool debtRepaymentSet; - public bool debtRepayment - { - get - { - return this.debtRepaymentField; - } - set - { - this.debtRepaymentField = value; - this.debtRepaymentSet = true; - } - } - public advancedFraudChecksType advancedFraudChecks; - public wallet wallet; - - public override String Serialize() - { - string xml = "\r\n"; - if (litleTxnIdSet) xml += "\r\n" + litleTxnIdField + ""; - xml += "\r\n" + orderId + ""; - xml += "\r\n" + amount + ""; - if (secondaryAmountSet) xml += "\r\n" + secondaryAmountField + ""; - if (surchargeAmountSet) xml += "\r\n" + surchargeAmountField + ""; - if (orderSource != null) xml += "\r\n" + orderSource.Serialize() + ""; - if (customerInfo != null) - { - xml += "\r\n" + customerInfo.Serialize() + "\r\n"; - } - if (billToAddress != null) - { - xml += "\r\n" + billToAddress.Serialize() + "\r\n"; - } - if (shipToAddress != null) - { - xml += "\r\n" + shipToAddress.Serialize() + "\r\n"; - } - if (card != null) - { - xml += "\r\n" + card.Serialize() + "\r\n"; - } - else if (paypal != null) - { - xml += "\r\n" + paypal.Serialize() + "\r\n"; - } - else if (token != null) - { - xml += "\r\n" + token.Serialize() + "\r\n"; - } - else if (mpos != null) - { - xml += "\r\n" + mpos.Serialize() + ""; - } - else if (paypage != null) - { - xml += "\r\n" + paypage.Serialize() + "\r\n"; - } - else if (applepay != null) - { - xml += "\r\n" + applepay.Serialize() + "\r\n"; - } - if (billMeLaterRequest != null) - { - xml += "\r\n" + billMeLaterRequest.Serialize() + "\r\n"; - } - if (cardholderAuthentication != null) - { - xml += "\r\n" + cardholderAuthentication.Serialize() + "\r\n"; - } - if (customBilling != null) - { - xml += "\r\n" + customBilling.Serialize() + "\r\n"; - } - if (taxTypeSet) - { - xml += "\r\n" + taxTypeField + ""; - } - if (enhancedData != null) - { - xml += "\r\n" + enhancedData.Serialize() + "\r\n"; - } - if (processingInstructions != null) - { - xml += "\r\n" + processingInstructions.Serialize() + "\r\n"; - } - if (pos != null) - { - xml += "\r\n" + pos.Serialize() + "\r\n"; - } - if (payPalOrderCompleteSet) xml += "\r\n" + payPalOrderCompleteField.ToString().ToLower() + ""; - if (payPalNotes != null) xml += "\r\n" + SecurityElement.Escape(payPalNotes) + ""; - if (amexAggregatorData != null) - { - xml += "\r\n" + amexAggregatorData.Serialize() + "\r\n"; - } - if (allowPartialAuthSet) - { - xml += "\r\n" + allowPartialAuthField.ToString().ToLower() + ""; - } - if (healthcareIIAS != null) - { - xml += "\r\n" + healthcareIIAS.Serialize() + "\r\n"; - } - if (filtering != null) - { - xml += "\r\n" + filtering.Serialize() + "\r\n"; - } - if (merchantData != null) - { - xml += "\r\n" + merchantData.Serialize() + "\r\n"; - } - if (recyclingRequest != null) - { - xml += "\r\n" + recyclingRequest.Serialize() + "\r\n"; - } - if (fraudFilterOverrideSet) xml += "\r\n" + fraudFilterOverrideField.ToString().ToLower() + ""; - if (recurringRequest != null) - { - xml += "\r\n" + recurringRequest.Serialize() + "\r\n"; - } - if (litleInternalRecurringRequest != null) - { - xml += "\r\n" + litleInternalRecurringRequest.Serialize() + "\r\n"; - } - if (debtRepaymentSet) xml += "\r\n" + debtRepayment.ToString().ToLower() + ""; - if (advancedFraudChecks != null) xml += "\r\n" + advancedFraudChecks.Serialize() + "\r\n"; - if (wallet != null) - { - xml += "\r\n" + wallet.Serialize() + "\r\n"; - } - xml += "\r\n"; - return xml; - } - } - - public partial class forceCapture : transactionTypeWithReportGroup - { - public string orderId; - public long amount; - private bool secondaryAmountSet; - private long secondaryAmountField; - public long secondaryAmount - { - get { return this.secondaryAmountField; } - set { this.secondaryAmountField = value; this.secondaryAmountSet = true; } - } - private bool surchargeAmountSet; - private long surchargeAmountField; - public long surchargeAmount - { - get { return this.surchargeAmountField; } - set { this.surchargeAmountField = value; this.surchargeAmountSet = true; } - } - public orderSourceType orderSource; - public contact billToAddress; - public cardType card; - public mposType mpos; - public cardTokenType token; - public cardPaypageType paypage; - public customBilling customBilling; - private govtTaxTypeEnum taxTypeField; - private bool taxTypeSet; - public govtTaxTypeEnum taxType - { - get { return this.taxTypeField; } - set { this.taxTypeField = value; this.taxTypeSet = true; } - } - public enhancedData enhancedData; - public processingInstructions processingInstructions; - public pos pos; - public amexAggregatorData amexAggregatorData; - public merchantDataType merchantData; - private bool debtRepaymentField; - private bool debtRepaymentSet; - public bool debtRepayment - { - get - { - return this.debtRepaymentField; - } - set - { - this.debtRepaymentField = value; - this.debtRepaymentSet = true; - } - } - - public override String Serialize() - { - string xml = "\r\n"; - xml += "\r\n" + SecurityElement.Escape(orderId) + ""; - xml += "\r\n" + amount + ""; - if (secondaryAmountSet) xml += "\r\n" + secondaryAmountField + ""; - if (surchargeAmountSet) xml += "\r\n" + surchargeAmountField + ""; - if (orderSource != null) xml += "\r\n" + orderSource.Serialize() + ""; - if (billToAddress != null) - { - xml += "\r\n" + billToAddress.Serialize() + "\r\n"; - } - if (card != null) - { - xml += "\r\n" + card.Serialize() + "\r\n"; - } - else if (token != null) - { - xml += "\r\n" + token.Serialize() + "\r\n"; - } - else if (mpos != null) - { - xml += "\r\n" + mpos.Serialize() + ""; - } - else if (paypage != null) - { - xml += "\r\n" + paypage.Serialize() + "\r\n"; - } - if (customBilling != null) - { - xml += "\r\n" + customBilling.Serialize() + "\r\n"; - } - if (taxTypeSet) - { - xml += "\r\n" + taxTypeField + ""; - } - if (enhancedData != null) - { - xml += "\r\n" + enhancedData.Serialize() + "\r\n"; - } - if (processingInstructions != null) - { - xml += "\r\n" + processingInstructions.Serialize() + "\r\n"; - } - if (pos != null) - { - xml += "\r\n" + pos.Serialize() + "\r\n"; - } - if (amexAggregatorData != null) - { - xml += "\r\n" + amexAggregatorData.Serialize() + "\r\n"; - } - if (merchantData != null) - { - xml += "\r\n" + merchantData.Serialize() + "\r\n"; - } - if (debtRepaymentSet) xml += "\r\n" + debtRepayment.ToString().ToLower() + ""; - xml += "\r\n"; - return xml; - } - } - - public partial class captureGivenAuth : transactionTypeWithReportGroup - { - public string orderId; - public authInformation authInformation; - public long amount; - private bool secondaryAmountSet; - private long secondaryAmountField; - public long secondaryAmount - { - get { return this.secondaryAmountField; } - set { this.secondaryAmountField = value; this.secondaryAmountSet = true; } - } - private bool surchargeAmountSet; - private long surchargeAmountField; - public long surchargeAmount - { - get { return this.surchargeAmountField; } - set { this.surchargeAmountField = value; this.surchargeAmountSet = true; } - } - public orderSourceType orderSource; - public contact billToAddress; - public contact shipToAddress; - public cardType card; - public mposType mpos; - public cardTokenType token; - public cardPaypageType paypage; - public customBilling customBilling; - private govtTaxTypeEnum taxTypeField; - private bool taxTypeSet; - public govtTaxTypeEnum taxType - { - get { return this.taxTypeField; } - set { this.taxTypeField = value; this.taxTypeSet = true; } - } - public billMeLaterRequest billMeLaterRequest; - public enhancedData enhancedData; - public processingInstructions processingInstructions; - public pos pos; - public amexAggregatorData amexAggregatorData; - public merchantDataType merchantData; - private bool debtRepaymentField; - private bool debtRepaymentSet; - public bool debtRepayment - { - get - { - return this.debtRepaymentField; - } - set - { - this.debtRepaymentField = value; - this.debtRepaymentSet = true; - } - } - - public override String Serialize() - { - string xml = "\r\n"; - xml += "\r\n" + SecurityElement.Escape(orderId) + ""; - if (authInformation != null) xml += "\r\n" + authInformation.Serialize() + "\r\n"; - xml += "\r\n" + amount + ""; - if (secondaryAmountSet) xml += "\r\n" + secondaryAmountField + ""; - if (surchargeAmountSet) xml += "\r\n" + surchargeAmountField + ""; - if (orderSource != null) xml += "\r\n" + orderSource.Serialize() + ""; - if (billToAddress != null) - { - xml += "\r\n" + billToAddress.Serialize() + "\r\n"; - } - if (shipToAddress != null) - { - xml += "\r\n" + shipToAddress.Serialize() + "\r\n"; - } - if (card != null) - { - xml += "\r\n" + card.Serialize() + "\r\n"; - } - else if (token != null) - { - xml += "\r\n" + token.Serialize() + "\r\n"; - } - else if (mpos != null) - { - xml += "\r\n" + mpos.Serialize() + ""; - } - else if (paypage != null) - { - xml += "\r\n" + paypage.Serialize() + "\r\n"; - } - if (customBilling != null) - { - xml += "\r\n" + customBilling.Serialize() + "\r\n"; - } - if (taxTypeSet) - { - xml += "\r\n" + taxTypeField + ""; - } - if (billMeLaterRequest != null) - { - xml += "\r\n" + billMeLaterRequest.Serialize() + "\r\n"; - } - if (enhancedData != null) - { - xml += "\r\n" + enhancedData.Serialize() + "\r\n"; - } - if (processingInstructions != null) - { - xml += "\r\n" + processingInstructions.Serialize() + "\r\n"; - } - if (pos != null) - { - xml += "\r\n" + pos.Serialize() + "\r\n"; - } - if (amexAggregatorData != null) - { - xml += "\r\n" + amexAggregatorData.Serialize() + "\r\n"; - } - if (merchantData != null) - { - xml += "\r\n" + merchantData.Serialize() + "\r\n"; - } - if (debtRepaymentSet) xml += "\r\n" + debtRepayment.ToString().ToLower() + ""; - xml += "\r\n"; - return xml; - } - } - - public partial class cancelSubscription : recurringTransactionType - { - private long subscriptionIdField; - private bool subscriptionIdSet; - public long subscriptionId - { - get - { - return this.subscriptionIdField; - } - set - { - this.subscriptionIdField = value; - this.subscriptionIdSet = true; - } - } - - public override String Serialize() - { - string xml = "\r\n"; - if (subscriptionIdSet) xml += "\r\n" + subscriptionIdField + ""; - xml += "\r\n"; - return xml; - } - } - - [System.SerializableAttribute()] - [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://www.litle.com/schema")] - public enum intervalType - { - ANNUAL, - SEMIANNUAL, - QUARTERLY, - MONTHLY, - WEEKLY - } - - [System.SerializableAttribute()] - [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://www.litle.com/schema")] - public enum trialIntervalType - { - MONTH, - DAY - } - - public partial class createPlan : recurringTransactionType - { - public string planCode; - public string name; - - private string descriptionField; - private bool descriptionSet; - public string description - { - get { return this.descriptionField; } - set { this.descriptionField = value; this.descriptionSet = true; } - } - - public intervalType intervalType; - public long amount; - - public int numberOfPaymentsField; - public bool numberOfPaymentsSet; - public int numberOfPayments - { - get { return this.numberOfPaymentsField; } - set { this.numberOfPaymentsField = value; this.numberOfPaymentsSet = true; } - } - - public int trialNumberOfIntervalsField; - public bool trialNumberOfIntervalsSet; - public int trialNumberOfIntervals - { - get { return this.trialNumberOfIntervalsField; } - set { this.trialNumberOfIntervalsField = value; this.trialNumberOfIntervalsSet = true; } - } - - private trialIntervalType trialIntervalTypeField; - private bool trialIntervalTypeSet; - public trialIntervalType trialIntervalType - { - get { return this.trialIntervalTypeField; } - set { this.trialIntervalTypeField = value; this.trialIntervalTypeSet = true; } - } - - private bool activeField; - private bool activeSet; - public bool active - { - get { return this.activeField; } - set { this.activeField = value; this.activeSet = true; } - } - - public override String Serialize() - { - string xml = "\r\n"; - xml += "\r\n" + SecurityElement.Escape(planCode) + ""; - xml += "\r\n" + SecurityElement.Escape(name) + ""; - if (descriptionSet) xml += "\r\n" + SecurityElement.Escape(descriptionField) + ""; - xml += "\r\n" + intervalType + ""; - xml += "\r\n" + amount + ""; - if (numberOfPaymentsSet) xml += "\r\n" + numberOfPaymentsField + ""; - if (trialNumberOfIntervalsSet) xml += "\r\n" + trialNumberOfIntervalsField + ""; - if (trialIntervalTypeSet) xml += "\r\n" + trialIntervalTypeField + ""; - if (activeSet) xml += "\r\n" + activeField.ToString().ToLower() + ""; - xml += "\r\n"; - return xml; - } - } - - public partial class updatePlan : recurringTransactionType - { - public string planCode; - - private bool activeField; - private bool activeSet; - public bool active - { - get { return this.activeField; } - set { this.activeField = value; this.activeSet = true; } - } - - public override String Serialize() - { - string xml = "\r\n"; - xml += "\r\n" + SecurityElement.Escape(planCode) + ""; - if (activeSet) xml += "\r\n" + activeField.ToString().ToLower() + ""; - xml += "\r\n"; - return xml; - } - } - public partial class updateSubscription : recurringTransactionType - { - private long subscriptionIdField; - private bool subscriptionIdSet; - public long subscriptionId - { - get - { - return this.subscriptionIdField; - } - set - { - this.subscriptionIdField = value; - this.subscriptionIdSet = true; - } - } - - public string planCode; - public contact billToAddress; - public cardType card; - public cardTokenType token; - public cardPaypageType paypage; - private DateTime billingDateField; - private bool billingDateSet; - public DateTime billingDate - { - get - { - return this.billingDateField; - } - set - { - this.billingDateField = value; - this.billingDateSet = true; - } - } - - public List createDiscounts; - public List updateDiscounts; - public List deleteDiscounts; - public List createAddOns; - public List updateAddOns; - public List deleteAddOns; - - public updateSubscription() - { - createDiscounts = new List(); - updateDiscounts = new List(); - deleteDiscounts = new List(); - createAddOns = new List(); - updateAddOns = new List(); - deleteAddOns = new List(); - } - - public override String Serialize() - { - string xml = "\r\n"; - if (subscriptionIdSet) xml += "\r\n" + subscriptionIdField + ""; - if (planCode != null) xml += "\r\n" + SecurityElement.Escape(planCode) + ""; - if (billToAddress != null) xml += "\r\n" + billToAddress.Serialize() + "\r\n"; - if (card != null) xml += "\r\n" + card.Serialize() + "\r\n"; - else if (token != null) xml += "\r\n" + token.Serialize() + "\r\n"; - else if (paypage != null) xml += "\r\n" + paypage.Serialize() + "\r\n"; - if (billingDateSet) xml += "\r\n" + XmlUtil.toXsdDate(billingDateField) + ""; - foreach (createDiscount createDiscount in createDiscounts) - { - xml += "\r\n" + createDiscount.Serialize() + "\r\n"; - } - foreach (updateDiscount updateDiscount in updateDiscounts) - { - xml += "\r\n" + updateDiscount.Serialize() + "\r\n"; - } - foreach (deleteDiscount deleteDiscount in deleteDiscounts) - { - xml += "\r\n" + deleteDiscount.Serialize() + "\r\n"; - } - foreach (createAddOn createAddOn in createAddOns) - { - xml += "\r\n" + createAddOn.Serialize() + "\r\n"; - } - foreach (updateAddOn updateAddOn in updateAddOns) - { - xml += "\r\n" + updateAddOn.Serialize() + "\r\n"; - } - foreach (deleteAddOn deleteAddOn in deleteAddOns) - { - xml += "\r\n" + deleteAddOn.Serialize() + "\r\n"; - } - xml += "\r\n"; - return xml; - } - } - - public partial class fraudResult - { - public string Serialize() - { - string xml = ""; - if (avsResult != null) xml += "\r\n" + SecurityElement.Escape(avsResult) + ""; - if (cardValidationResult != null) xml += "\r\n" + SecurityElement.Escape(cardValidationResult) + ""; - if (authenticationResult != null) xml += "\r\n" + SecurityElement.Escape(authenticationResult) + ""; - if (advancedAVSResult != null) xml += "\r\n" + SecurityElement.Escape(advancedAVSResult) + ""; - return xml; - } - } - - public partial class authInformation - { - public DateTime authDate; - public string authCode; - public fraudResult fraudResult; - private long authAmountField; - private bool authAmountSet; - public long authAmount - { - get { return this.authAmountField; } - set { this.authAmountField = value; this.authAmountSet = true; } - } - - public string Serialize() - { - string xml = ""; - if (authDate != null) xml += "\r\n" + XmlUtil.toXsdDate(authDate) + ""; - if (authCode != null) xml += "\r\n" + SecurityElement.Escape(authCode) + ""; - if (fraudResult != null) xml += "\r\n" + fraudResult.Serialize() + ""; - if (authAmountSet) xml += "\r\n" + authAmountField + ""; - return xml; - } - } - - public class XmlUtil - { - public static string toXsdDate(DateTime dateTime) - { - string year = dateTime.Year.ToString(); - string month = dateTime.Month.ToString(); - if (dateTime.Month < 10) - { - month = "0" + month; - } - string day = dateTime.Day.ToString(); - if (dateTime.Day < 10) - { - day = "0" + day; - } - return year + "-" + month + "-" + day; - } - } - - public partial class recyclingRequestType - { - private recycleByTypeEnum recycleByField; - private bool recycleBySet; - public recycleByTypeEnum recycleBy - { - get { return this.recycleByField; } - set { this.recycleByField = value; this.recycleBySet = true; } - } - public string recycleId; - - public string Serialize() - { - string xml = ""; - if (recycleBySet) xml += "\r\n" + recycleByField + ""; - if (recycleId != null) xml += "\r\n" + SecurityElement.Escape(recycleId) + ""; - return xml; - } - } - - public partial class litleInternalRecurringRequest - { - public string subscriptionId; - public string recurringTxnId; - - private bool finalPaymentField; - private bool finalPaymentSet; - public bool finalPayment - { - get { return this.finalPaymentField; } - set { this.finalPaymentField = value; this.finalPaymentSet = true; } - } - - public string Serialize() - { - string xml = ""; - if (subscriptionId != null) xml += "\r\n" + SecurityElement.Escape(subscriptionId) + ""; - if (recurringTxnId != null) xml += "\r\n" + SecurityElement.Escape(recurringTxnId) + ""; - if(finalPaymentSet) xml += "\r\n" + finalPaymentField.ToString().ToLower() + ""; - return xml; - } - } - - public partial class createDiscount - { - public string discountCode; - public string name; - public long amount; - public DateTime startDate; - public DateTime endDate; - - public string Serialize() - { - string xml = ""; - xml += "\r\n" + SecurityElement.Escape(discountCode) + ""; - xml += "\r\n" + SecurityElement.Escape(name) + ""; - xml += "\r\n" + amount + ""; - xml += "\r\n" + XmlUtil.toXsdDate(startDate) + ""; - xml += "\r\n" + XmlUtil.toXsdDate(endDate) + ""; - return xml; - } - } - - public partial class updateDiscount - { - public string discountCode; - - private string nameField; - private bool nameSet; - public string name - { - get { return this.nameField; } - set { this.nameField = value; this.nameSet = true; } - } - - private long amountField; - private bool amountSet; - public long amount - { - get { return this.amountField; } - set { this.amountField = value; this.amountSet = true; } - } - - private DateTime startDateField; - private bool startDateSet; - public DateTime startDate - { - get { return this.startDateField; } - set { this.startDateField = value; this.startDateSet = true; } - } - - private DateTime endDateField; - private bool endDateSet; - public DateTime endDate - { - get { return this.endDateField; } - set { this.endDateField = value; this.endDateSet = true; } - } - - public string Serialize() - { - string xml = ""; - xml += "\r\n" + SecurityElement.Escape(discountCode) + ""; - if (nameSet) xml += "\r\n" + SecurityElement.Escape(nameField) + ""; - if (amountSet) xml += "\r\n" + amountField + ""; - if (startDateSet) xml += "\r\n" + XmlUtil.toXsdDate(startDateField) + ""; - if (endDateSet) xml += "\r\n" + XmlUtil.toXsdDate(endDateField) + ""; - return xml; - } - } - - public partial class deleteDiscount - { - public string discountCode; - - public string Serialize() - { - string xml = ""; - xml += "\r\n" + SecurityElement.Escape(discountCode) + ""; - return xml; - } - } - - public partial class createAddOn - { - public string addOnCode; - public string name; - public long amount; - public DateTime startDate; - public DateTime endDate; - - public string Serialize() - { - string xml = ""; - xml += "\r\n" + SecurityElement.Escape(addOnCode) + ""; - xml += "\r\n" + SecurityElement.Escape(name) + ""; - xml += "\r\n" + amount + ""; - xml += "\r\n" + XmlUtil.toXsdDate(startDate) + ""; - xml += "\r\n" + XmlUtil.toXsdDate(endDate) + ""; - return xml; - } - } - - public partial class updateAddOn - { - public string addOnCode; - - private string nameField; - private bool nameSet; - public string name - { - get { return this.nameField; } - set { this.nameField = value; this.nameSet = true; } - } - - private long amountField; - private bool amountSet; - public long amount - { - get { return this.amountField; } - set { this.amountField = value; this.amountSet = true; } - } - - private DateTime startDateField; - private bool startDateSet; - public DateTime startDate - { - get { return this.startDateField; } - set { this.startDateField = value; this.startDateSet = true; } - } - - private DateTime endDateField; - private bool endDateSet; - public DateTime endDate - { - get { return this.endDateField; } - set { this.endDateField = value; this.endDateSet = true; } - } - - public string Serialize() - { - string xml = ""; - xml += "\r\n" + SecurityElement.Escape(addOnCode) + ""; - if (nameSet) xml += "\r\n" + SecurityElement.Escape(nameField) + ""; - if (amountSet) xml += "\r\n" + amountField + ""; - if (startDateSet) xml += "\r\n" + XmlUtil.toXsdDate(startDateField) + ""; - if (endDateSet) xml += "\r\n" + XmlUtil.toXsdDate(endDateField) + ""; - return xml; - } - } - - public partial class deleteAddOn - { - public string addOnCode; - - public string Serialize() - { - string xml = ""; - xml += "\r\n" + SecurityElement.Escape(addOnCode) + ""; - return xml; - } - } - - - public partial class subscription - { - public string planCode; - private bool numberOfPaymentsSet; - private int numberOfPaymentsField; - public int numberOfPayments - { - get { return this.numberOfPaymentsField; } - set { this.numberOfPaymentsField = value; this.numberOfPaymentsSet = true; } - } - private bool startDateSet; - private DateTime startDateField; - public DateTime startDate - { - get { return this.startDateField; } - set { this.startDateField = value; this.startDateSet = true; } - } - private bool amountSet; - private long amountField; - public long amount - { - get { return this.amountField; } - set { this.amountField = value; this.amountSet = true; } - } - - public List createDiscounts; - public List createAddOns; - - public subscription() - { - createDiscounts = new List(); - createAddOns = new List(); - } - - - public string Serialize() - { - string xml = ""; - xml += "\r\n" + planCode + ""; - if(numberOfPaymentsSet) xml += "\r\n" + numberOfPayments + ""; - if (startDateSet) xml += "\r\n" + XmlUtil.toXsdDate(startDateField) + ""; - if(amountSet) xml += "\r\n" + amountField + ""; - foreach(createDiscount createDiscount in createDiscounts) - { - xml += "\r\n" + createDiscount.Serialize() + "\r\n"; - } - foreach (createAddOn createAddOn in createAddOns) - { - xml += "\r\n" + createAddOn.Serialize() + "\r\n"; - } - - return xml; - } - } - - - - - - public partial class filteringType - { - private bool prepaidField; - private bool prepaidSet; - public bool prepaid - { - get { return this.prepaidField; } - set { this.prepaidField = value; this.prepaidSet = true; } - } - - private bool internationalField; - private bool internationalSet; - public bool international - { - get { return this.internationalField; } - set { this.internationalField = value; this.internationalSet = true; } - } - - private bool chargebackField; - private bool chargebackSet; - public bool chargeback - { - get { return this.chargebackField; } - set { this.chargebackField = value; this.chargebackSet = true; } - } - - public string Serialize() - { - string xml = ""; - if (prepaidSet) xml += "\r\n" + prepaidField.ToString().ToLower() + ""; - if (internationalSet) xml += "\r\n" + internationalField.ToString().ToLower() + ""; - if (chargebackSet) xml += "\r\n" + chargebackField.ToString().ToLower() + ""; - return xml; - } - - } - - public partial class healthcareIIAS - { - public healthcareAmounts healthcareAmounts; - private IIASFlagType IIASFlagField; - private bool IIASFlagSet; - public IIASFlagType IIASFlag - { - get { return this.IIASFlagField; } - set { this.IIASFlagField = value; this.IIASFlagSet = true; } - } - - public string Serialize() - { - string xml = ""; - if (healthcareAmounts != null) xml += "\r\n" + healthcareAmounts.Serialize() + ""; - if (IIASFlagSet) xml += "\r\n" + IIASFlagField + ""; - return xml; - } - } - - public partial class recurringRequest - { - public subscription subscription; - - public string Serialize() - { - string xml = ""; - if (subscription != null) xml += "\r\n" + subscription.Serialize() + "\r\n"; - return xml; - } - } - - - public partial class healthcareAmounts - { - private int totalHealthcareAmountField; - private bool totalHealthcareAmountSet; - public int totalHealthcareAmount - { - get { return this.totalHealthcareAmountField; } - set { this.totalHealthcareAmountField = value; this.totalHealthcareAmountSet = true; } - } - - private int RxAmountField; - private bool RxAmountSet; - public int RxAmount - { - get { return this.RxAmountField; } - set { this.RxAmountField = value; this.RxAmountSet = true; } - } - - private int visionAmountField; - private bool visionAmountSet; - public int visionAmount - { - get { return this.visionAmountField; } - set { this.visionAmountField = value; this.visionAmountSet = true; } - } - - private int clinicOtherAmountField; - private bool clinicOtherAmountSet; - public int clinicOtherAmount - { - get { return this.clinicOtherAmountField; } - set { this.clinicOtherAmountField = value; this.clinicOtherAmountSet = true; } - } - - private int dentalAmountField; - private bool dentalAmountSet; - public int dentalAmount - { - get { return this.dentalAmountField; } - set { this.dentalAmountField = value; this.dentalAmountSet = true; } - } - - public string Serialize() - { - string xml = ""; - if (totalHealthcareAmountSet) xml += "\r\n" + totalHealthcareAmountField + ""; - if (RxAmountSet) xml += "\r\n" + RxAmountField + ""; - if (visionAmountSet) xml += "\r\n" + visionAmountField + ""; - if (clinicOtherAmountSet) xml += "\r\n" + clinicOtherAmountField + ""; - if (dentalAmountSet) xml += "\r\n" + dentalAmountField + ""; - return xml; - } - } - - public sealed class orderSourceType - { - public static readonly orderSourceType ecommerce = new orderSourceType("ecommerce"); - public static readonly orderSourceType installment = new orderSourceType("installment"); - public static readonly orderSourceType mailorder = new orderSourceType("mailorder"); - public static readonly orderSourceType recurring = new orderSourceType("recurring"); - public static readonly orderSourceType retail = new orderSourceType("retail"); - public static readonly orderSourceType telephone = new orderSourceType("telephone"); - public static readonly orderSourceType item3dsAuthenticated = new orderSourceType("3dsAuthenticated"); - public static readonly orderSourceType item3dsAttempted = new orderSourceType("3dsAttempted"); - public static readonly orderSourceType recurringtel = new orderSourceType("recurringtel"); - public static readonly orderSourceType echeckppd = new orderSourceType("echeckppd"); - public static readonly orderSourceType applepay = new orderSourceType("applepay"); - - private orderSourceType(String value) { this.value = value; } - public string Serialize() { return value; } - private string value; - } - - public partial class contact - { - - public string name; - public string firstName; - public string middleInitial; - public string lastName; - public string companyName; - public string addressLine1; - public string addressLine2; - public string addressLine3; - public string city; - public string state; - public string zip; - private countryTypeEnum countryField; - private bool countrySpecified; - public countryTypeEnum country - { - get { return this.countryField; } - set { this.countryField = value; countrySpecified = true; } - } - public string email; - public string phone; - - public string Serialize() - { - string xml = ""; - if (name != null) xml += "\r\n" + SecurityElement.Escape(name) + ""; - if (firstName != null) xml += "\r\n" + SecurityElement.Escape(firstName) + ""; - if (middleInitial != null) xml += "\r\n" + SecurityElement.Escape(middleInitial) + ""; - if (lastName != null) xml += "\r\n" + SecurityElement.Escape(lastName) + ""; - if (companyName != null) xml += "\r\n" + SecurityElement.Escape(companyName) + ""; - if (addressLine1 != null) xml += "\r\n" + SecurityElement.Escape(addressLine1) + ""; - if (addressLine2 != null) xml += "\r\n" + SecurityElement.Escape(addressLine2) + ""; - if (addressLine3 != null) xml += "\r\n" + SecurityElement.Escape(addressLine3) + ""; - if (city != null) xml += "\r\n" + SecurityElement.Escape(city) + ""; - if (state != null) xml += "\r\n" + SecurityElement.Escape(state) + ""; - if (zip != null) xml += "\r\n" + SecurityElement.Escape(zip) + ""; - if (countrySpecified) xml += "\r\n" + countryField + ""; - if (email != null) xml += "\r\n" + SecurityElement.Escape(email) + ""; - if (phone != null) xml += "\r\n" + SecurityElement.Escape(phone) + ""; - return xml; - } - } - - public enum countryTypeEnum - { - - /// - USA, - AF, - AX, - AL, - DZ, - AS, - AD, - AO, - AI, - AQ, - AG, - AR, - AM, - AW, - AU, - AT, - AZ, - BS, - BH, - BD, - BB, - BY, - BE, - BZ, - BJ, - BM, - BT, - BO, - BQ, - BA, - BW, - BV, - BR, - IO, - BN, - BG, - BF, - BI, - KH, - CM, - CA, - CV, - KY, - CF, - TD, - CL, - CN, - CX, - CC, - CO, - KM, - CG, - CD, - CK, - CR, - CI, - HR, - CU, - CW, - CY, - CZ, - DK, - DJ, - DM, - DO, - TL, - EC, - EG, - SV, - GQ, - ER, - EE, - ET, - FK, - FO, - FJ, - FI, - FR, - GF, - PF, - TF, - GA, - GM, - GE, - DE, - GH, - GI, - GR, - GL, - GD, - GP, - GU, - GT, - GG, - GN, - GW, - GY, - HT, - HM, - HN, - HK, - HU, - IS, - IN, - ID, - IR, - IQ, - IE, - IM, - IL, - IT, - JM, - JP, - JE, - JO, - KZ, - KE, - KI, - KP, - KR, - KW, - KG, - LA, - LV, - LB, - LS, - LR, - LY, - LI, - LT, - LU, - MO, - MK, - MG, - MW, - MY, - MV, - ML, - MT, - MH, - MQ, - MR, - MU, - YT, - MX, - FM, - MD, - MC, - MN, - MS, - MA, - MZ, - MM, - NA, - NR, - NP, - NL, - AN, - NC, - NZ, - NI, - NE, - NG, - NU, - NF, - MP, - NO, - OM, - PK, - PW, - PS, - PA, - PG, - PY, - PE, - PH, - PN, - PL, - PT, - PR, - QA, - RE, - RO, - RU, - RW, - BL, - KN, - LC, - MF, - VC, - WS, - SM, - ST, - SA, - SN, - SC, - SL, - SG, - SX, - SK, - SI, - SB, - SO, - ZA, - GS, - ES, - LK, - SH, - PM, - SD, - SR, - SJ, - SZ, - SE, - CH, - SY, - TW, - TJ, - TZ, - TH, - TG, - TK, - TO, - TT, - TN, - TR, - TM, - TC, - TV, - UG, - UA, - AE, - GB, - US, - UM, - UY, - UZ, - VU, - VA, - VE, - VN, - VG, - VI, - WF, - EH, - YE, - ZM, - ZW, - RS, - ME, - } - - public partial class fraudCheckType - { - public String authenticationValue; - public String authenticationTransactionId; - public String customerIpAddress; - private bool authenticatedByMerchantField; - private bool authenticatedByMerchantSet; - public bool authenticatedByMerchant - { - get { return this.authenticatedByMerchantField; } - set { this.authenticatedByMerchantField = value; authenticatedByMerchantSet = true; } - } - - public string Serialize() - { - string xml = ""; - if (authenticationValue != null) xml += "\r\n" + SecurityElement.Escape(authenticationValue) + ""; - if (authenticationTransactionId != null) xml += "\r\n" + SecurityElement.Escape(authenticationTransactionId) + ""; - if (customerIpAddress != null) xml += "\r\n" + SecurityElement.Escape(customerIpAddress) + ""; - if (authenticatedByMerchantSet) xml += "\r\n" + authenticatedByMerchantField + ""; - return xml; - } - } - - public partial class advancedFraudChecksType - { - public string threatMetrixSessionId; - private string customAttribute1Field; - private bool customAttribute1Set; - public string customAttribute1 { - get { return this.customAttribute1Field; } - set { this.customAttribute1Field = value; customAttribute1Set = true; } - } - private string customAttribute2Field; - private bool customAttribute2Set; - public string customAttribute2 - { - get { return this.customAttribute2Field; } - set { this.customAttribute2Field = value; customAttribute2Set = true; } - } - private string customAttribute3Field; - private bool customAttribute3Set; - public string customAttribute3 - { - get { return this.customAttribute3Field; } - set { this.customAttribute3Field = value; customAttribute3Set = true; } - } - private string customAttribute4Field; - private bool customAttribute4Set; - public string customAttribute4 - { - get { return this.customAttribute4Field; } - set { this.customAttribute4Field = value; customAttribute4Set = true; } - } - private string customAttribute5Field; - private bool customAttribute5Set; - public string customAttribute5 - { - get { return this.customAttribute5Field; } - set { this.customAttribute5Field = value; customAttribute5Set = true; } - } - - public string Serialize() - { - string xml = ""; - if (threatMetrixSessionId != null) xml += "\r\n" + SecurityElement.Escape(threatMetrixSessionId) + ""; - if (customAttribute1Set) xml += "\r\n" + SecurityElement.Escape(customAttribute1Field) + ""; - if (customAttribute2Set) xml += "\r\n" + SecurityElement.Escape(customAttribute2Field) + ""; - if (customAttribute3Set) xml += "\r\n" + SecurityElement.Escape(customAttribute3Field) + ""; - if (customAttribute4Set) xml += "\r\n" + SecurityElement.Escape(customAttribute4Field) + ""; - if (customAttribute5Set) xml += "\r\n" + SecurityElement.Escape(customAttribute5Field) + ""; - return xml; - } - } - - public partial class mposType { - public string ksn; - public string formatId; - public string encryptedTrack; - public int track1Status; - public int track2Status; - - public string Serialize() - { - string xml = ""; - if (ksn != null) - { - xml += "\r\n" + ksn + ""; - } - if (formatId != null) - { - xml += "\r\n" + formatId + ""; - } - if (encryptedTrack != null) - { - xml += "\r\n" + SecurityElement.Escape(encryptedTrack) + ""; - } - if (track1Status == 0 || track1Status == 1 ) - { - xml += "\r\n" + track1Status + ""; - } - if (track2Status == 0 || track2Status == 1) - { - xml += "\r\n" + track2Status + ""; - } - - return xml; - } - } - - public partial class cardType - { - public methodOfPaymentTypeEnum type; - public string number; - public string expDate; - public string track; - public string cardValidationNum; - - public string Serialize() - { - string xml = ""; - if (track == null) - { - xml += "\r\n" + methodOfPaymentSerializer.Serialize(type) + ""; - if (number != null) - { - xml += "\r\n" + SecurityElement.Escape(number) + ""; - } - if (expDate != null) - { - xml += "\r\n" + SecurityElement.Escape(expDate) + ""; - } - } - else - { - xml += "\r\n" + SecurityElement.Escape(track) + ""; - } - if (cardValidationNum != null) - { - xml += "\r\n" + SecurityElement.Escape(cardValidationNum) + ""; - } - return xml; - } - } - - public partial class virtualGiftCardType - { - public int accountNumberLength - { - get { return this.accountNumberLengthField; } - set { this.accountNumberLengthField = value; accountNumberLengthSet = true; } - } - private int accountNumberLengthField; - private bool accountNumberLengthSet; - - public string giftCardBin; - - public String Serialize() - { - String xml = ""; - if (accountNumberLengthSet) xml += "\r\n" + accountNumberLengthField + ""; - if (giftCardBin != null) xml += "\r\n" + SecurityElement.Escape(giftCardBin) + ""; - return xml; - } - - } - - public partial class authReversal : transactionTypeWithReportGroup - { - public long litleTxnId; - private long amountField; - private bool amountSet; - public long amount - { - get { return this.amountField; } - set { this.amountField = value; amountSet = true; } - } - private bool surchargeAmountSet; - private long surchargeAmountField; - public long surchargeAmount - { - get { return this.surchargeAmountField; } - set { this.surchargeAmountField = value; this.surchargeAmountSet = true; } - } - public string payPalNotes; - public string actionReason; - - public override string Serialize() - { - string xml = "\r\n"; - xml += "\r\n" + litleTxnId + ""; - if (amountSet) - { - xml += "\r\n" + amountField + ""; - } - if (surchargeAmountSet) xml += "\r\n" + surchargeAmountField + ""; - if (payPalNotes != null) - { - xml += "\r\n" + SecurityElement.Escape(payPalNotes) + ""; - } - if (actionReason != null) - { - xml += "\r\n" + SecurityElement.Escape(actionReason) + ""; - } - xml += "\r\n"; - return xml; - } - - } - - public partial class echeckVoid : transactionTypeWithReportGroup - { - public long litleTxnId; - - public override string Serialize() - { - string xml = "\r\n"; - xml += "\r\n" + litleTxnId + ""; - xml += "\r\n"; - return xml; - } - - } - - public class accountUpdate : transactionTypeWithReportGroup - { - public string orderId; - public cardType card; - public cardTokenType token; - - public override string Serialize() - { - string xml = "\r\n"; - - xml += "\r\n" + SecurityElement.Escape(orderId) + ""; - - if (card != null) - { - xml += "\r\n"; - xml += card.Serialize(); - xml += "\r\n"; - } - else if (token != null) - { - xml += "\r\n"; - xml += token.Serialize(); - xml += "\r\n"; - } - - xml += "\r\n"; - - return xml; - } - } - - public class accountUpdateFileRequestData - { - public string merchantId; - public accountUpdateFileRequestData() - { - merchantId = Properties.Settings.Default.merchantId; - } - public accountUpdateFileRequestData(Dictionary config) - { - this.merchantId = config["merchantId"]; - } - public DateTime postDay; //yyyy-MM-dd - - public string Serialize() - { - string xml = "\r\n" + SecurityElement.Escape(merchantId) + ""; - - if (postDay != null) - { - xml += "\r\n" + postDay.ToString("yyyy-MM-dd") + ""; - } - - return xml; - } - } - - public partial class activate : transactionTypeWithReportGroup - { - public string orderId; - public long amount; - public orderSourceType orderSource; - public cardType card; - public virtualGiftCardType virtualGiftCard; - - public override string Serialize() - { - string xml = "\r\n"; - xml += "\r\n" + SecurityElement.Escape(orderId) + ""; - xml += "\r\n" + amount + ""; - xml += "\r\n" + orderSource.Serialize() + ""; - if (card != null) xml += "\r\n" + card.Serialize() + "\r\n"; - else if (virtualGiftCard != null) xml += "\r\n" + virtualGiftCard.Serialize() + "\r\n"; - xml += "\r\n"; - return xml; - } - } - - public partial class deactivate : transactionTypeWithReportGroup - { - public string orderId; - public orderSourceType orderSource; - public cardType card; - - public override string Serialize() - { - string xml = "\r\n"; - xml += "\r\n" + SecurityElement.Escape(orderId) + ""; - xml += "\r\n" + orderSource.Serialize() + ""; - xml += "\r\n" + card.Serialize() + "\r\n"; - xml += "\r\n"; - return xml; - } - } - - public partial class load : transactionTypeWithReportGroup - { - public string orderId; - public long amount; - public orderSourceType orderSource; - public cardType card; - - public override string Serialize() - { - string xml = "\r\n"; - xml += "\r\n" + SecurityElement.Escape(orderId) + ""; - xml += "\r\n" + amount + ""; - xml += "\r\n" + orderSource.Serialize() + ""; - xml += "\r\n" + card.Serialize() + "\r\n"; - xml += "\r\n"; - return xml; - } - } - - public partial class unload : transactionTypeWithReportGroup - { - public string orderId; - public long amount; - public orderSourceType orderSource; - public cardType card; - - public override string Serialize() - { - string xml = "\r\n"; - xml += "\r\n" + SecurityElement.Escape(orderId) + ""; - xml += "\r\n" + amount + ""; - xml += "\r\n" + orderSource.Serialize() + ""; - xml += "\r\n" + card.Serialize() + "\r\n"; - xml += "\r\n"; - return xml; - } - } - - public partial class balanceInquiry : transactionTypeWithReportGroup - { - public string orderId; - public orderSourceType orderSource; - public cardType card; - - public override string Serialize() - { - string xml = "\r\n"; - xml += "\r\n" + SecurityElement.Escape(orderId) + ""; - xml += "\r\n" + orderSource.Serialize() + ""; - xml += "\r\n" + card.Serialize() + "\r\n"; - xml += "\r\n"; - return xml; - } - } - - public partial class loadReversal : transactionTypeWithReportGroup - { - public String litleTxnId; - - public override string Serialize() - { - string xml = "\r\n"; - xml += "\r\n" + SecurityElement.Escape(litleTxnId) + ""; - xml += "\r\n"; - return xml; - } - } - - public partial class unloadReversal : transactionTypeWithReportGroup - { - public String litleTxnId; - - public override string Serialize() - { - string xml = "\r\n"; - xml += "\r\n" + SecurityElement.Escape(litleTxnId) + ""; - xml += "\r\n"; - return xml; - } - } - - public partial class deactivateReversal : transactionTypeWithReportGroup - { - public String litleTxnId; - - public override string Serialize() - { - string xml = "\r\n"; - xml += "\r\n" + SecurityElement.Escape(litleTxnId) + ""; - xml += "\r\n"; - return xml; - } - } - - public partial class activateReversal : transactionTypeWithReportGroup - { - public String litleTxnId; - - public override string Serialize() - { - string xml = "\r\n"; - xml += "\r\n" + SecurityElement.Escape(litleTxnId) + ""; - xml += "\r\n"; - return xml; - } - } - - public partial class refundReversal : transactionTypeWithReportGroup - { - public String litleTxnId; - - public override string Serialize() - { - string xml = "\r\n"; - xml += "\r\n" + SecurityElement.Escape(litleTxnId) + ""; - xml += "\r\n"; - return xml; - } - } - - public partial class depositReversal : transactionTypeWithReportGroup - { - public String litleTxnId; - - public override string Serialize() - { - string xml = "\r\n"; - xml += "\r\n" + SecurityElement.Escape(litleTxnId) + ""; - xml += "\r\n"; - return xml; - } - } - - public partial class applepayType - { - public string data; - public applepayHeaderType header; - public string signature; - public string version; - - public string Serialize() - { - string xml = ""; - if (data != null) xml += "\r\n" + SecurityElement.Escape(data) + ""; - if (header != null) xml += "\r\n
" + header.Serialize() + "
"; - if (signature != null) xml += "\r\n" + SecurityElement.Escape(signature) + ""; - if (version != null) xml += "\r\n" + SecurityElement.Escape(version) + ""; - return xml; - } - } - - public partial class applepayHeaderType - { - public string applicationData; - public string ephemeralPublicKey; - public string publicKeyHash; - public string transactionId; - - public string Serialize() - { - string xml = ""; - if (applicationData != null) xml += "\r\n" + SecurityElement.Escape(applicationData) + ""; - if (ephemeralPublicKey != null) xml += "\r\n" + SecurityElement.Escape(ephemeralPublicKey) + ""; - if (publicKeyHash != null) xml += "\r\n" + SecurityElement.Escape(publicKeyHash) + ""; - if (transactionId != null) xml += "\r\n" + SecurityElement.Escape(transactionId) + ""; - return xml; - } - } - - public partial class wallet - { - public walletWalletSourceType walletSourceType; - public string walletSourceTypeId; - - public string Serialize() - { - string xml = ""; - if (walletSourceType != null) xml += "\r\n" + walletSourceType + ""; - if (walletSourceTypeId != null) xml += "\r\n" + SecurityElement.Escape(walletSourceTypeId) + ""; - return xml; - } - } - - public enum walletWalletSourceType - { - MasterPass - } - - public partial class fraudCheck : transactionTypeWithReportGroup - { - - public advancedFraudChecksType advancedFraudChecks; - - private contact billToAddressField; - private bool billToAddressSet; - public contact billToAddress - { - get - { - return this.billToAddressField; - } - set - { - this.billToAddressField = value; this.billToAddressSet = true; - } - } - - private contact shipToAddressField; - private bool shipToAddressSet; - public contact shipToAddress - { - get - { - return this.shipToAddressField; - } - set - { - this.shipToAddressField = value; this.shipToAddressSet = true; - } - } - - private int amountField; - private bool amountSet; - public int amount - { - get - { - return this.amountField; - } - set - { - this.amountField = value; this.amountSet = true; - } - } - - public override string Serialize() - { - string xml = ""; - if (advancedFraudChecks != null) xml += "\r\n" + advancedFraudChecks.Serialize() + ""; - if (billToAddressSet) xml += "\r\n" + billToAddressField.Serialize() + ""; - if (shipToAddressSet) xml += "\r\n" + shipToAddressField.Serialize() + ""; - if (amountSet) xml += "\r\n" + amountField.ToString() + ""; - return xml; - } - } -} +using System; +using System.Collections.Generic; +using System.Security; +using System.Xml.Serialization; + +namespace Litle.Sdk +{ + public class litleOnlineRequest + { + + public string merchantId; + public string merchantSdk; + public authentication authentication; + public authorization authorization; + public capture capture; + public credit credit; + public voidTxn voidTxn; + public sale sale; + public authReversal authReversal; + public echeckCredit echeckCredit; + public echeckVerification echeckVerification; + public echeckSale echeckSale; + public registerTokenRequestType registerTokenRequest; + public forceCapture forceCapture; + public captureGivenAuth captureGivenAuth; + public echeckRedeposit echeckRedeposit; + public echeckVoid echeckVoid; + public updateCardValidationNumOnToken updateCardValidationNumOnToken; + public updateSubscription updateSubscription; + public cancelSubscription cancelSubscription; + public activate activate; + public deactivate deactivate; + public load load; + public unload unload; + public balanceInquiry balanceInquiry; + public createPlan createPlan; + public updatePlan updatePlan; + public refundReversal refundReversal; + public loadReversal loadReversal; + public depositReversal depositReversal; + public activateReversal activateReversal; + public deactivateReversal deactivateReversal; + public unloadReversal unloadReversal; + public fraudCheck fraudCheck; + + public string Serialize() + { + string xml = "\r\n" + + authentication.Serialize(); + + if (authorization != null) xml += authorization.Serialize(); + else if (capture != null) xml += capture.Serialize(); + else if (credit != null) xml += credit.Serialize(); + else if (voidTxn != null) xml += voidTxn.Serialize(); + else if (sale != null) xml += sale.Serialize(); + else if (authReversal != null) xml += authReversal.Serialize(); + else if (echeckCredit != null) xml += echeckCredit.Serialize(); + else if (echeckVerification != null) xml += echeckVerification.Serialize(); + else if (echeckSale != null) xml += echeckSale.Serialize(); + else if (registerTokenRequest != null) xml += registerTokenRequest.Serialize(); + else if (forceCapture != null) xml += forceCapture.Serialize(); + else if (captureGivenAuth != null) xml += captureGivenAuth.Serialize(); + else if (echeckRedeposit != null) xml += echeckRedeposit.Serialize(); + else if (echeckVoid != null) xml += echeckVoid.Serialize(); + else if (updateCardValidationNumOnToken != null) xml += updateCardValidationNumOnToken.Serialize(); + else if (updateSubscription != null) xml += updateSubscription.Serialize(); + else if (cancelSubscription != null) xml += cancelSubscription.Serialize(); + else if (activate != null) xml += activate.Serialize(); + else if (deactivate != null) xml += deactivate.Serialize(); + else if (load != null) xml += load.Serialize(); + else if (unload != null) xml += unload.Serialize(); + else if (balanceInquiry != null) xml += balanceInquiry.Serialize(); + else if (createPlan != null) xml += createPlan.Serialize(); + else if (updatePlan != null) xml += updatePlan.Serialize(); + else if (refundReversal != null) xml += refundReversal.Serialize(); + else if (loadReversal != null) xml += loadReversal.Serialize(); + else if (depositReversal != null) xml += depositReversal.Serialize(); + else if (activateReversal != null) xml += activateReversal.Serialize(); + else if (deactivateReversal != null) xml += deactivateReversal.Serialize(); + else if (unloadReversal != null) xml += unloadReversal.Serialize(); + else if (fraudCheck != null) xml += fraudCheck.Serialize(); + xml += "\r\n"; + + return xml; + } + } + + + public class authentication + { + public string user; + public string password; + public string Serialize() + { + return "\r\n\r\n" + SecurityElement.Escape(user) + "\r\n" + SecurityElement.Escape(password) + "\r\n"; + } + } + + public class customerInfo + { + + public string ssn; + + public DateTime dob; + + public DateTime customerRegistrationDate; + + private customerInfoCustomerType customerTypeField; + private bool customerTypeSet; + public customerInfoCustomerType customerType + { + get { return customerTypeField; } + set { customerTypeField = value; customerTypeSet = true; } + } + + private long incomeAmountField; + private bool incomeAmountSet; + public long incomeAmount + { + get { return incomeAmountField; } + set { incomeAmountField = value; incomeAmountSet = true; } + } + + private currencyCodeEnum incomeCurrencyField; + private bool incomeCurrencySet; + public currencyCodeEnum incomeCurrency + { + get { return incomeCurrencyField; } + set { incomeCurrencyField = value; incomeCurrencySet = true; } + } + + private bool customerCheckingAccountField; + private bool customerCheckingAccountSet; + public bool customerCheckingAccount + { + get { return customerCheckingAccountField; } + set { customerCheckingAccountField = value; customerCheckingAccountSet = true; } + } + + private bool customerSavingAccountField; + private bool customerSavingAccountSet; + public bool customerSavingAccount + { + get { return customerSavingAccountField; } + set { customerSavingAccountField = value; customerSavingAccountSet = true; } + } + + public string employerName; + + public string customerWorkTelephone; + + private customerInfoResidenceStatus residenceStatusField; + private bool residenceStatusSet; + public customerInfoResidenceStatus residenceStatus + { + get { return residenceStatusField; } + set { residenceStatusField = value; residenceStatusSet = true; } + } + + private int yearsAtResidenceField; + private bool yearsAtResidenceSet; + public int yearsAtResidence + { + get { return yearsAtResidenceField; } + set { yearsAtResidenceField = value; yearsAtResidenceSet = true; } + } + + private int yearsAtEmployerField; + private bool yearsAtEmployerSet; + public int yearsAtEmployer + { + get + { + return yearsAtEmployerField; + } + set + { + yearsAtEmployerField = value; + yearsAtEmployerSet = true; + } + } + + + public customerInfo() + { + incomeCurrency = currencyCodeEnum.USD; + } + + public string Serialize() + { + string xml = ""; + if (ssn != null) + { + xml += "\r\n" + SecurityElement.Escape(ssn) + ""; + } + if (dob != null) + { + xml += "\r\n" + XmlUtil.toXsdDate(dob) + ""; + } + if (customerRegistrationDate != null) + { + xml += "\r\n" + XmlUtil.toXsdDate(customerRegistrationDate) + ""; + } + if (customerTypeSet) + { + xml += "\r\n" + customerTypeField + ""; + } + if (incomeAmountSet) + { + xml += "\r\n" + incomeAmountField + ""; + } + if (incomeCurrencySet) + { + xml += "\r\n" + incomeCurrencyField + ""; + } + if (customerCheckingAccountSet) + { + xml += "\r\n" + customerCheckingAccountField.ToString().ToLower() + ""; + } + if (customerSavingAccountSet) + { + xml += "\r\n" + customerSavingAccountField.ToString().ToLower() + ""; + } + if (employerName != null) + { + xml += "\r\n" + SecurityElement.Escape(employerName) + ""; + } + if (customerWorkTelephone != null) + { + xml += "\r\n" + SecurityElement.Escape(customerWorkTelephone) + ""; + } + if (residenceStatusSet) + { + xml += "\r\n" + residenceStatusField + ""; + } + if (yearsAtResidenceSet) + { + xml += "\r\n" + yearsAtResidenceField + ""; + } + if (yearsAtEmployerSet) + { + xml += "\r\n" + yearsAtEmployerField + ""; + } + return xml; + } + + + } + + public enum customerInfoCustomerType + { + + /// + New, + Existing, + } + + public enum currencyCodeEnum + { + + /// + AUD, + CAD, + CHF, + DKK, + EUR, + GBP, + HKD, + JPY, + NOK, + NZD, + SEK, + SGD, + USD, + } + + public enum customerInfoResidenceStatus + { + + /// + Own, + Rent, + Other, + } + + public partial class enhancedData + { + public string customerReference; + private long salesTaxField; + private bool salesTaxSet; + public long salesTax + { + get { return salesTaxField; } + set { salesTaxField = value; salesTaxSet = true; } + } + private enhancedDataDeliveryType deliveryTypeField; + private bool deliveryTypeSet; + public enhancedDataDeliveryType deliveryType + { + get { return deliveryTypeField; } + set { deliveryTypeField = value; deliveryTypeSet = true; } + } + public bool taxExemptField; + public bool taxExemptSet; + public bool taxExempt + { + get { return taxExemptField; } + set { taxExemptField = value; taxExemptSet = true; } + } + private long discountAmountField; + private bool discountAmountSet; + public long discountAmount + { + get { return discountAmountField; } + set { discountAmountField = value; discountAmountSet = true; } + } + private long shippingAmountField; + private bool shippingAmountSet; + public long shippingAmount + { + get { return shippingAmountField; } + set { shippingAmountField = value; shippingAmountSet = true; } + } + private long dutyAmountField; + private bool dutyAmountSet; + public long dutyAmount + { + get { return dutyAmountField; } + set { dutyAmountField = value; dutyAmountSet = true; } + } + public string shipFromPostalCode; + public string destinationPostalCode; + private countryTypeEnum destinationCountryCodeField; + private bool destinationCountryCodeSet; + public countryTypeEnum destinationCountry + { + get { return destinationCountryCodeField; } + set { destinationCountryCodeField = value; destinationCountryCodeSet = true; } + } + public string invoiceReferenceNumber; + private DateTime orderDateField; + private bool orderDateSet; + public DateTime orderDate + { + get { return orderDateField; } + set { orderDateField = value; orderDateSet = true; } + } + public List detailTaxes; + public List lineItems; + + public enhancedData() + { + lineItems = new List(); + detailTaxes = new List(); + } + + public string Serialize() + { + string xml = ""; + if (customerReference != null) xml += "\r\n" + SecurityElement.Escape(customerReference) + ""; + if (salesTaxSet) xml += "\r\n" + salesTaxField + ""; + if (deliveryTypeSet) xml += "\r\n" + deliveryTypeField + ""; + if (taxExemptSet) xml += "\r\n" + taxExemptField.ToString().ToLower() + ""; + if (discountAmountSet) xml += "\r\n" + discountAmountField + ""; + if (shippingAmountSet) xml += "\r\n" + shippingAmountField + ""; + if (dutyAmountSet) xml += "\r\n" + dutyAmountField + ""; + if (shipFromPostalCode != null) xml += "\r\n" + SecurityElement.Escape(shipFromPostalCode) + ""; + if (destinationPostalCode != null) xml += "\r\n" + SecurityElement.Escape(destinationPostalCode) + ""; + if (destinationCountryCodeSet) xml += "\r\n" + destinationCountryCodeField + ""; + if (invoiceReferenceNumber != null) xml += "\r\n" + SecurityElement.Escape(invoiceReferenceNumber) + ""; + if (orderDateSet) xml += "\r\n" + XmlUtil.toXsdDate(orderDateField) + ""; + foreach (detailTax detailTax in detailTaxes) + { + xml += "\r\n" + detailTax.Serialize() + "\r\n"; + } + foreach (lineItemData lineItem in lineItems) + { + xml += "\r\n" + lineItem.Serialize() + "\r\n"; + } + return xml; + } + } + + public partial class voidTxn : transactionTypeWithReportGroup + { + public long litleTxnId; + public processingInstructions processingInstructions; + + public override string Serialize() + { + string xml = "\r\n"; + if (processingInstructions != null) xml += "\r\n" + processingInstructions.Serialize() + "\r\n"; + xml += "\r\n"; + + return xml; + } + + } + + public partial class lineItemData + { + private int itemSeqenceNumberField; + private bool itemSequenceNumberSet; + public int itemSequenceNumber + { + get { return itemSeqenceNumberField; } + set { itemSeqenceNumberField = value; itemSequenceNumberSet = true; } + } + public string itemDescription; + public string productCode; + public string quantity; + public string unitOfMeasure; + private long taxAmountField; + private bool taxAmountSet; + public long taxAmount + { + get { return taxAmountField; } + set { taxAmountField = value; taxAmountSet = true; } + } + private long lineItemTotalField; + private bool lineItemTotalSet; + public long lineItemTotal + { + get { return lineItemTotalField; } + set { lineItemTotalField = value; lineItemTotalSet = true; } + } + private long lineItemTotalWithTaxField; + private bool lineItemTotalWithTaxSet; + public long lineItemTotalWithTax + { + get { return lineItemTotalWithTaxField; } + set { lineItemTotalWithTaxField = value; lineItemTotalWithTaxSet = true; } + } + private long itemDiscountAmountField; + private bool itemDiscountAmountSet; + public long itemDiscountAmount + { + get { return itemDiscountAmountField; } + set { itemDiscountAmountField = value; itemDiscountAmountSet = true; } + } + public string commodityCode; + public string unitCost; + public List detailTaxes; + + public lineItemData() + { + detailTaxes = new List(); + } + + public string Serialize() + { + string xml = ""; + if (itemSequenceNumberSet) xml += "\r\n" + itemSeqenceNumberField + ""; + if (itemDescription != null) xml += "\r\n" + SecurityElement.Escape(itemDescription) + ""; + if (productCode != null) xml += "\r\n" + SecurityElement.Escape(productCode) + ""; + if (quantity != null) xml += "\r\n" + SecurityElement.Escape(quantity) + ""; + if (unitOfMeasure != null) xml += "\r\n" + SecurityElement.Escape(unitOfMeasure) + ""; + if (taxAmountSet) xml += "\r\n" + taxAmountField + ""; + if (lineItemTotalSet) xml += "\r\n" + lineItemTotalField + ""; + if (lineItemTotalWithTaxSet) xml += "\r\n" + lineItemTotalWithTaxField + ""; + if (itemDiscountAmountSet) xml += "\r\n" + itemDiscountAmountField + ""; + if (commodityCode != null) xml += "\r\n" + SecurityElement.Escape(commodityCode) + ""; + if (unitCost != null) xml += "\r\n" + SecurityElement.Escape(unitCost) + ""; + foreach (detailTax detailTax in detailTaxes) + { + if (detailTax != null) xml += "\r\n" + detailTax.Serialize() + ""; + } + return xml; + } + + } + + + public partial class detailTax + { + private bool taxIncludedInTotalField; + private bool taxIncludedInTotalSet; + public bool taxIncludedInTotal + { + get { return taxIncludedInTotalField; } + set { taxIncludedInTotalField = value; taxIncludedInTotalSet = true; } + } + private long taxAmountField; + private bool taxAmountSet; + public long taxAmount + { + get { return taxAmountField; } + set { taxAmountField = value; taxAmountSet = true; } + } + public string taxRate; + private taxTypeIdentifierEnum taxTypeIdentifierField; + private bool taxTypeIdentifierSet; + public taxTypeIdentifierEnum taxTypeIdentifier + { + get { return taxTypeIdentifierField; } + set { taxTypeIdentifierField = value; taxTypeIdentifierSet = true; } + } + public string cardAcceptorTaxId; + + public string Serialize() + { + string xml = ""; + if (taxIncludedInTotalSet) xml += "\r\n" + taxIncludedInTotalField.ToString().ToLower() + ""; + if (taxAmountSet) xml += "\r\n" + taxAmountField + ""; + if (taxRate != null) xml += "\r\n" + SecurityElement.Escape(taxRate) + ""; + if (taxTypeIdentifierSet) xml += "\r\n" + taxTypeIdentifierField + ""; + if (cardAcceptorTaxId != null) xml += "\r\n" + SecurityElement.Escape(cardAcceptorTaxId) + ""; + return xml; + } + } + + public partial class transactionTypeWithReportGroupAndPartial : transactionType + { + public string reportGroup; + private bool partialField; + protected bool partialSet; + public bool partial + { + get { return partialField; } + set { partialField = value; partialSet = true; } + } + } + + public partial class capture : transactionTypeWithReportGroupAndPartial + { + public long litleTxnId; + private long amountField; + private bool amountSet; + public long amount + { + get { return amountField; } + set { amountField = value; amountSet = true; } + } + private bool surchargeAmountSet; + private long surchargeAmountField; + public long surchargeAmount + { + get { return surchargeAmountField; } + set { surchargeAmountField = value; surchargeAmountSet = true; } + } + public enhancedData enhancedData; + public processingInstructions processingInstructions; + private bool payPalOrderCompleteField; + private bool payPalOrderCompleteSet; + public bool payPalOrderComplete + { + get { return payPalOrderCompleteField; } + set { payPalOrderCompleteField = value; payPalOrderCompleteSet = true; } + } + public string payPalNotes; + + private string pinField; + private bool pinSet; + public string pin + { + get { return pinField; } + set { pinField = value; pinSet = true; } + } + + public override string Serialize() + { + string xml = "\r\n"; + if (amountSet) xml += "\r\n" + amountField + ""; + if (surchargeAmountSet) xml += "\r\n" + surchargeAmountField + ""; + if (enhancedData != null) xml += "\r\n" + enhancedData.Serialize() + "\r\n"; + if (processingInstructions != null) xml += "\r\n" + processingInstructions.Serialize() + "\r\n"; + if (payPalOrderCompleteSet) xml += "\r\n" + payPalOrderCompleteField.ToString().ToLower() + ""; + if (payPalNotes != null) xml += "\r\n" + SecurityElement.Escape(payPalNotes) + ""; + if (pinSet) xml += "\r\n" + pin + ""; + xml += "\r\n"; + + return xml; + } + } + + public partial class echeckCredit : transactionTypeWithReportGroup + { + private long litleTxnIdField; + private bool litleTxnIdSet; + public long litleTxnId + { + get { return litleTxnIdField; } + set { litleTxnIdField = value; litleTxnIdSet = true; } + } + private long amountField; + private bool amountSet; + public long amount + { + get { return amountField; } + set { amountField = value; amountSet = true; } + } + private bool secondaryAmountSet; + private long secondaryAmountField; + public long secondaryAmount + { + get { return secondaryAmountField; } + set { secondaryAmountField = value; secondaryAmountSet = true; } + } + public customBilling customBilling; + public string orderId; + public orderSourceType orderSource; + public contact billToAddress; + public echeckType echeck; + + [Obsolete()] + public echeckTokenType token + { + get { return echeckToken; } + set { echeckToken = value; } + } + + public echeckTokenType echeckToken; + + public merchantDataType merchantData; + + public override string Serialize() + { + string xml = "\r\n"; + if (amountSet) xml += "\r\n" + amountField + ""; + if (secondaryAmountSet) xml += "\r\n" + secondaryAmountField + ""; + if (customBilling != null) xml += "\r\n" + customBilling.Serialize() + ""; + } + else + { + xml += "\r\n" + SecurityElement.Escape(orderId) + ""; + xml += "\r\n" + amountField + ""; + if (secondaryAmountSet) xml += "\r\n" + secondaryAmountField + ""; + if (orderSource != null) xml += "\r\n" + orderSource.Serialize() + ""; + if (billToAddress != null) xml += "\r\n" + billToAddress.Serialize() + ""; + if (echeck != null) xml += "\r\n" + echeck.Serialize() + ""; + else if (echeckToken != null) xml += "\r\n" + echeckToken.Serialize() + ""; + if (customBilling != null) xml += "\r\n" + customBilling.Serialize() + ""; + if (merchantData != null) xml += "\r\n" + merchantData.Serialize() + ""; + } + xml += "\r\n"; + return xml; + } + } + + public partial class echeckSale : transactionTypeWithReportGroup + { + private long litleTxnIdField; + private bool litleTxnIdSet; + public long litleTxnId + { + get { return litleTxnIdField; } + set { litleTxnIdField = value; litleTxnIdSet = true; } + } + private long amountField; + private bool amountSet; + public long amount + { + get { return amountField; } + set { amountField = value; amountSet = true; } + } + private bool secondaryAmountSet; + private long secondaryAmountField; + public long secondaryAmount + { + get { return secondaryAmountField; } + set { secondaryAmountField = value; secondaryAmountSet = true; } + } + public customBilling customBilling; + public string orderId; + private bool verifyField; + private bool verifySet; + public bool verify + { + get { return verifyField; } + set { verifyField = value; verifySet = true; } + } + public orderSourceType orderSource; + public contact billToAddress; + public contact shipToAddress; + public echeckType echeck; + public echeckTokenType token; + public merchantDataType merchantData; + + public override string Serialize() + { + string xml = "\r\n"; + if (amountSet) xml += "\r\n" + amountField + ""; + // let sandbox do the validation for secondaryAmount + if (secondaryAmountSet) xml += "\r\n" + secondaryAmountField + ""; + if (customBilling != null) xml += "\r\n" + customBilling.Serialize() + ""; + } + else + { + xml += "\r\n" + SecurityElement.Escape(orderId) + ""; + if (verifySet) xml += "\r\n" + (verifyField ? "true" : "false") + ""; + xml += "\r\n" + amountField + ""; + if (secondaryAmountSet) xml += "\r\n" + secondaryAmountField + ""; + if (orderSource != null) xml += "\r\n" + orderSource.Serialize() + ""; + if (billToAddress != null) xml += "\r\n" + billToAddress.Serialize() + ""; + if (shipToAddress != null) xml += "\r\n" + shipToAddress.Serialize() + ""; + if (echeck != null) xml += "\r\n" + echeck.Serialize() + ""; + else if (token != null) xml += "\r\n" + token.Serialize() + ""; + if (customBilling != null) xml += "\r\n" + customBilling.Serialize() + ""; + if (merchantData != null) xml += "\r\n" + merchantData.Serialize() + ""; + } + xml += "\r\n"; + return xml; + } + } + + + public partial class echeckVerification : transactionTypeWithReportGroup + { + private long litleTxnIdField; + private bool litleTxnIdSet; + public long litleTxnId + { + get { return litleTxnIdField; } + set { litleTxnIdField = value; litleTxnIdSet = true; } + } + public string orderId; + private long amountField; + private bool amountSet; + public long amount + { + get { return amountField; } + set { amountField = value; amountSet = true; } + } + public orderSourceType orderSource; + public contact billToAddress; + public echeckType echeck; + public echeckTokenType token; + public merchantDataType merchantData; + + public override string Serialize() + { + string xml = "\r\n"; + xml += "\r\n" + orderId + ""; + if (amountSet) xml += "\r\n" + amountField + ""; + if (orderSource != null) xml += "\r\n" + orderSource.Serialize() + ""; + if (billToAddress != null) xml += "\r\n" + billToAddress.Serialize() + ""; + if (echeck != null) xml += "\r\n" + echeck.Serialize() + ""; + else if (token != null) xml += "\r\n" + token.Serialize() + ""; + if (merchantData != null) xml += "\r\n" + merchantData.Serialize() + ""; + xml += "\r\n"; + return xml; + } + } + + public partial class registerTokenRequestType : transactionTypeWithReportGroup + { + public string orderId; + public string accountNumber; + public echeckForTokenType echeckForToken; + public string paypageRegistrationId; + public string cardValidationNum; + public applepayType applepay; + + public override string Serialize() + { + string xml = "\r\n"; + if (accountNumber != null) xml += "\r\n" + accountNumber + ""; + else if (echeckForToken != null) xml += "\r\n" + echeckForToken.Serialize() + ""; + else if (paypageRegistrationId != null) xml += "\r\n" + paypageRegistrationId + ""; + else if (applepay != null) xml += "\r\n" + applepay.Serialize() + "\r\n"; + if (cardValidationNum != null) xml += "\r\n" + cardValidationNum + ""; + xml += "\r\n"; + return xml; + } + } + + public partial class updateCardValidationNumOnToken : transactionTypeWithReportGroup + { + public string orderId; + public string litleToken; + public string cardValidationNum; + + public override string Serialize() + { + string xml = "\r\n"; + if (litleToken != null) xml += "\r\n" + SecurityElement.Escape(litleToken) + ""; + if (cardValidationNum != null) xml += "\r\n" + SecurityElement.Escape(cardValidationNum) + ""; + xml += "\r\n"; + return xml; + } + } + + public partial class echeckForTokenType + { + public string accNum; + public string routingNum; + + public string Serialize() + { + string xml = ""; + if (accNum != null) xml += "\r\n" + SecurityElement.Escape(accNum) + ""; + if (routingNum != null) xml += "\r\n" + SecurityElement.Escape(routingNum) + ""; + return xml; + } + } + + + public class credit : transactionTypeWithReportGroup + { + private long litleTxnIdField; + private bool litleTxnIdSet; + public long litleTxnId + { + get { return litleTxnIdField; } + set { litleTxnIdField = value; litleTxnIdSet = true; } + } + private long amountField; + private bool amountSet; + public long amount + { + get { return amountField; } + set { amountField = value; amountSet = true; } + } + private bool secondaryAmountSet; + private long secondaryAmountField; + public long secondaryAmount + { + get { return secondaryAmountField; } + set { secondaryAmountField = value; secondaryAmountSet = true; } + } + private bool surchargeAmountSet; + private long surchargeAmountField; + public long surchargeAmount + { + get { return surchargeAmountField; } + set { surchargeAmountField = value; surchargeAmountSet = true; } + } + public customBilling customBilling; + public enhancedData enhancedData; + public processingInstructions processingInstructions; + public string orderId; + public orderSourceType orderSource; + public contact billToAddress; + public cardType card; + public mposType mpos; + public cardTokenType token; + public cardPaypageType paypage; + public payPal paypal; + private taxTypeIdentifierEnum taxTypeField; + private bool taxTypeSet; + public taxTypeIdentifierEnum taxType + { + get { return taxTypeField; } + set { taxTypeField = value; taxTypeSet = true; } + } + public billMeLaterRequest billMeLaterRequest; + public pos pos; + public amexAggregatorData amexAggregatorData; + public merchantDataType merchantData; + public string payPalNotes; + public string actionReason; + + private string pinField; + private bool pinSet; + public string pin + { + get { return pinField; } + set { pinField = value; pinSet = true; } + } + + public override string Serialize() + { + string xml = "\r\n"; + if (amountSet) xml += "\r\n" + amountField + ""; + if (secondaryAmountSet) xml += "\r\n" + secondaryAmountField + ""; + if (surchargeAmountSet) xml += "\r\n" + surchargeAmountField + ""; + if (customBilling != null) xml += "\r\n" + customBilling.Serialize() + ""; + if (enhancedData != null) xml += "\r\n" + enhancedData.Serialize() + ""; + if (processingInstructions != null) xml += "\r\n" + processingInstructions.Serialize() + ""; + if (pos != null) xml += "\r\n" + pos.Serialize() + ""; + if (pinSet) { xml += "\r\n" + pin + ""; } + } + else + { + xml += "\r\n" + SecurityElement.Escape(orderId) + ""; + xml += "\r\n" + amountField + ""; + if (secondaryAmountSet) xml += "\r\n" + secondaryAmountField + ""; + if (surchargeAmountSet) xml += "\r\n" + surchargeAmountField + ""; + if (orderSource != null) xml += "\r\n" + orderSource.Serialize() + ""; + if (billToAddress != null) xml += "\r\n" + billToAddress.Serialize() + ""; + if (card != null) xml += "\r\n" + card.Serialize() + ""; + else if (token != null) xml += "\r\n" + token.Serialize() + ""; + else if (mpos != null) xml += "\r\n" + mpos.Serialize() + ""; + else if (paypage != null) xml += "\r\n" + paypage.Serialize() + ""; + else if (paypal != null) + { + xml += "\r\n"; + if (paypal.payerId != null) xml += "\r\n" + SecurityElement.Escape(paypal.payerId) + ""; + else if (paypal.payerEmail != null) xml += "\r\n" + SecurityElement.Escape(paypal.payerEmail) + ""; + xml += "\r\n"; + } + if (customBilling != null) xml += "\r\n" + customBilling.Serialize() + ""; + if (taxTypeSet) xml += "\r\n" + taxTypeField + ""; + if (billMeLaterRequest != null) xml += "\r\n" + billMeLaterRequest.Serialize() + ""; + if (enhancedData != null) xml += "\r\n" + enhancedData.Serialize() + ""; + if (processingInstructions != null) xml += "\r\n" + processingInstructions.Serialize() + ""; + if (pos != null) xml += "\r\n" + pos.Serialize() + ""; + if (amexAggregatorData != null) xml += "\r\n" + amexAggregatorData.Serialize() + ""; + if (merchantData != null) xml += "\r\n" + merchantData.Serialize() + ""; + } + if (payPalNotes != null) xml += "\r\n" + SecurityElement.Escape(payPalNotes) + ""; + if (actionReason != null) xml += "\r\n" + SecurityElement.Escape(actionReason) + ""; + xml += "\r\n"; + return xml; + } + } + + public partial class echeckType + { + private echeckAccountTypeEnum accTypeField; + private bool accTypeSet; + public echeckAccountTypeEnum accType + { + get { return accTypeField; } + set { accTypeField = value; accTypeSet = true; } + } + + public string accNum; + public string routingNum; + public string checkNum; + public string ccdPaymentInformation; + + public string Serialize() + { + string xml = ""; + string accTypeName = accTypeField.ToString(); + XmlEnumAttribute[] attributes = + (XmlEnumAttribute[])typeof(echeckAccountTypeEnum).GetMember(accTypeField.ToString())[0].GetCustomAttributes(typeof(XmlEnumAttribute), false); + if (attributes.Length > 0) accTypeName = attributes[0].Name; + if (accTypeSet) xml += "\r\n" + accTypeName + ""; + if (accNum != null) xml += "\r\n" + SecurityElement.Escape(accNum) + ""; + if (routingNum != null) xml += "\r\n" + SecurityElement.Escape(routingNum) + ""; + if (checkNum != null) xml += "\r\n" + SecurityElement.Escape(checkNum) + ""; + if (ccdPaymentInformation != null) xml += "\r\n" + SecurityElement.Escape(ccdPaymentInformation) + ""; + return xml; + } + } + + public partial class echeckTokenType + { + public string litleToken; + public string routingNum; + private echeckAccountTypeEnum accTypeField; + private bool accTypeSet; + public echeckAccountTypeEnum accType + { + get { return accTypeField; } + set { accTypeField = value; accTypeSet = true; } + } + public string checkNum; + + public string Serialize() + { + string xml = ""; + if (litleToken != null) xml += "\r\n" + SecurityElement.Escape(litleToken) + ""; + if (routingNum != null) xml += "\r\n" + SecurityElement.Escape(routingNum) + ""; + string accTypeName = accTypeField.ToString(); + XmlEnumAttribute[] attributes = + (XmlEnumAttribute[])typeof(echeckAccountTypeEnum).GetMember(accTypeField.ToString())[0].GetCustomAttributes(typeof(XmlEnumAttribute), false); + if (attributes.Length > 0) accTypeName = attributes[0].Name; + if (accTypeSet) xml += "\r\n" + accTypeName + ""; + if (checkNum != null) xml += "\r\n" + SecurityElement.Escape(checkNum) + ""; + return xml; + } + + } + + + public partial class pos + { + private posCapabilityTypeEnum capabilityField; + private bool capabilitySet; + public posCapabilityTypeEnum capability + { + get { return capabilityField; } + set { capabilityField = value; capabilitySet = true; } + } + + private posEntryModeTypeEnum entryModeField; + private bool entryModeSet; + public posEntryModeTypeEnum entryMode + { + get { return entryModeField; } + set { entryModeField = value; entryModeSet = true; } + } + + private posCardholderIdTypeEnum cardholderIdField; + private bool cardholderIdSet; + public posCardholderIdTypeEnum cardholderId + { + get { return cardholderIdField; } + set { cardholderIdField = value; cardholderIdSet = true; } + } + public string terminalId; + + private posCatLevelEnum catLevelField; + private bool catLevelSet; + public posCatLevelEnum catLevel + { + get { return catLevelField; } + set { catLevelField = value; catLevelSet = true; } + } + + public string Serialize() + { + string xml = ""; + if (capabilitySet) xml += "\r\n" + capabilityField + ""; + if (entryModeSet) xml += "\r\n" + entryModeField + ""; + if (cardholderIdSet) xml += "\r\n" + cardholderIdField + ""; + if (terminalId != null) xml += "\r\n" + SecurityElement.Escape(terminalId) + ""; + if (catLevelSet) xml += "\r\n" + catLevelField.Serialize() +""; + return xml; + } + + } + + public partial class payPal + { + public string payerId; + public string payerEmail; + public string token; + public string transactionId; + + public string Serialize() + { + string xml = ""; + if (payerId != null) xml += "\r\n" + SecurityElement.Escape(payerId) + ""; + if (payerEmail != null) xml += "\r\n" + SecurityElement.Escape(payerEmail) + ""; + if (token != null) xml += "\r\n" + SecurityElement.Escape(token) + ""; + if (transactionId != null) xml += "\r\n" + SecurityElement.Escape(transactionId) + ""; + return xml; + } + } + + public partial class merchantDataType + { + public string campaign; + public string affiliate; + public string merchantGroupingId; + + public string Serialize() + { + string xml = ""; + if (campaign != null) xml += "\r\n" + SecurityElement.Escape(campaign) + ""; + if (affiliate != null) xml += "\r\n" + SecurityElement.Escape(affiliate) + ""; + if (merchantGroupingId != null) xml += "\r\n" + SecurityElement.Escape(merchantGroupingId) + ""; + return xml; + } + } + + public partial class cardTokenType + { + public string litleToken; + public string expDate; + public string cardValidationNum; + private methodOfPaymentTypeEnum typeField; + private bool typeSet; + public methodOfPaymentTypeEnum type + { + get { return typeField; } + set { typeField = value; typeSet = true; } + } + + public string Serialize() + { + string xml = "\r\n" + SecurityElement.Escape(litleToken) + ""; + if (expDate != null) xml += "\r\n" + SecurityElement.Escape(expDate) + ""; + if (cardValidationNum != null) xml += "\r\n" + SecurityElement.Escape(cardValidationNum) + ""; + if (typeSet) xml += "\r\n" + methodOfPaymentSerializer.Serialize(typeField) + ""; + return xml; + } + } + + public partial class cardPaypageType + { + public string paypageRegistrationId; + public string expDate; + public string cardValidationNum; + private methodOfPaymentTypeEnum typeField; + private bool typeSet; + public methodOfPaymentTypeEnum type + { + get { return typeField; } + set { typeField = value; typeSet = true; } + } + + public string Serialize() + { + string xml = "\r\n" + SecurityElement.Escape(paypageRegistrationId) + ""; + if (expDate != null) xml += "\r\n" + SecurityElement.Escape(expDate) + ""; + if (cardValidationNum != null) xml += "\r\n" + SecurityElement.Escape(cardValidationNum) + ""; + if (typeSet) xml += "\r\n" + methodOfPaymentSerializer.Serialize(typeField) + ""; + return xml; + } + } + + public partial class billMeLaterRequest + { + private long bmlMerchantIdField; + private bool bmlMerchantIdSet; + public long bmlMerchantId + { + get { return bmlMerchantIdField; } + set { bmlMerchantIdField = value; bmlMerchantIdSet = true; } + } + private long bmlProductTypeField; + private bool bmlProductTypeSet; + public long bmlProductType + { + get { return bmlProductTypeField; } + set { bmlProductTypeField = value; bmlProductTypeSet = true; } + } + private int termsAndConditionsField; + private bool termsAndConditionsSet; + public int termsAndConditions + { + get { return termsAndConditionsField; } + set { termsAndConditionsField = value; termsAndConditionsSet = true; } + } + public string preapprovalNumber; + private int merchantPromotionalCodeField; + private bool merchantPromotionalCodeSet; + public int merchantPromotionalCode + { + get { return merchantPromotionalCodeField; } + set { merchantPromotionalCodeField = value; merchantPromotionalCodeSet = true; } + } + public string virtualAuthenticationKeyPresenceIndicator; + public string virtualAuthenticationKeyData; + private int itemCategoryCodeField; + private bool itemCategoryCodeSet; + public int itemCategoryCode + { + get { return itemCategoryCodeField; } + set { itemCategoryCodeField = value; itemCategoryCodeSet = true; } + } + + public string Serialize() + { + string xml = ""; + if (bmlMerchantIdSet) xml += "\r\n" + bmlMerchantIdField + ""; + if (bmlProductTypeSet) xml += "\r\n" + bmlProductTypeField + ""; + if (termsAndConditionsSet) xml += "\r\n" + termsAndConditionsField + ""; + if (preapprovalNumber != null) xml += "\r\n" + SecurityElement.Escape(preapprovalNumber) + ""; + if (merchantPromotionalCodeSet) xml += "\r\n" + merchantPromotionalCodeField + ""; + if (virtualAuthenticationKeyPresenceIndicator != null) xml += "\r\n" + SecurityElement.Escape(virtualAuthenticationKeyPresenceIndicator) + ""; + if (virtualAuthenticationKeyData != null) xml += "\r\n" + SecurityElement.Escape(virtualAuthenticationKeyData) + ""; + if (itemCategoryCodeSet) xml += "\r\n" + itemCategoryCodeField + ""; + return xml; + } + + } + + public partial class customBilling + { + public string phone; + public string city; + public string url; + public string descriptor; + public string Serialize() + { + string xml = ""; + if (phone != null) xml += "\r\n" + SecurityElement.Escape(phone) + ""; + else if (city != null) xml += "\r\n" + SecurityElement.Escape(city) + ""; + else if (url != null) xml += "\r\n" + SecurityElement.Escape(url) + ""; + if (descriptor != null) xml += "\r\n" + SecurityElement.Escape(descriptor) + ""; + return xml; + } + } + + public partial class amexAggregatorData + { + public string sellerId; + public string sellerMerchantCategoryCode; + public string Serialize() + { + string xml = ""; + xml += "\r\n" + SecurityElement.Escape(sellerId) + ""; + xml += "\r\n" + SecurityElement.Escape(sellerMerchantCategoryCode) + ""; + return xml; + } + + } + + public partial class processingInstructions + { + private bool bypassVelocityCheckField; + private bool bypassVelocityCheckSet; + public bool bypassVelocityCheck + { + get { return bypassVelocityCheckField; } + set { bypassVelocityCheckField = value; bypassVelocityCheckSet = true; } + } + + public string Serialize() + { + string xml = ""; + if (bypassVelocityCheckSet) xml += "\r\n" + bypassVelocityCheckField.ToString().ToLower() + ""; + return xml; + } + } + + public partial class echeckRedeposit : baseRequestTransactionEcheckRedeposit + { + //litleTxnIdField and set are in super + public echeckType echeck; + public echeckTokenType token; + public merchantDataType merchantData; + + public override string Serialize() + { + string xml = "\r\n"; + if (litleTxnIdSet) xml += "\r\n" + litleTxnIdField + ""; + if (echeck != null) xml += "\r\n" + echeck.Serialize() + ""; + else if (token != null) xml += "\r\n" + token.Serialize() + ""; + if (merchantData != null) { xml += "\r\n" + merchantData.Serialize() + "\r\n"; } + xml += "\r\n"; + return xml; + } + } + + public partial class authorization : transactionTypeWithReportGroup + { + + private long litleTxnIdField; + private bool litleTxnIdSet; + public long litleTxnId + { + get + { + return litleTxnIdField; + } + set + { + litleTxnIdField = value; + litleTxnIdSet = true; + } + } + public string orderId; + public long amount; + private bool secondaryAmountSet; + private long secondaryAmountField; + public long secondaryAmount + { + get { return secondaryAmountField; } + set { secondaryAmountField = value; secondaryAmountSet = true; } + } + private bool surchargeAmountSet; + private long surchargeAmountField; + public long surchargeAmount + { + get { return surchargeAmountField; } + set { surchargeAmountField = value; surchargeAmountSet = true; } + } + public orderSourceType orderSource; + public customerInfo customerInfo; + public contact billToAddress; + public contact shipToAddress; + public cardType card; + public mposType mpos; + public payPal paypal; + public cardTokenType token; + public cardPaypageType paypage; + public applepayType applepay; + public billMeLaterRequest billMeLaterRequest; + public fraudCheckType cardholderAuthentication; + public processingInstructions processingInstructions; + public pos pos; + public customBilling customBilling; + private govtTaxTypeEnum taxTypeField; + private bool taxTypeSet; + public govtTaxTypeEnum taxType + { + get { return taxTypeField; } + set { taxTypeField = value; taxTypeSet = true; } + } + public enhancedData enhancedData; + public amexAggregatorData amexAggregatorData; + private bool allowPartialAuthField; + private bool allowPartialAuthSet; + public bool allowPartialAuth + { + get + { + return allowPartialAuthField; + } + set + { + allowPartialAuthField = value; + allowPartialAuthSet = true; + } + } + public healthcareIIAS healthcareIIAS; + public filteringType filtering; + public merchantDataType merchantData; + public recyclingRequestType recyclingRequest; + private bool fraudFilterOverrideField; + private bool fraudFilterOverrideSet; + public bool fraudFilterOverride + { + get + { + return fraudFilterOverrideField; + } + set + { + fraudFilterOverrideField = value; + fraudFilterOverrideSet = true; + } + } + public recurringRequest recurringRequest; + private bool debtRepaymentField; + private bool debtRepaymentSet; + public bool debtRepayment + { + get + { + return debtRepaymentField; + } + set + { + debtRepaymentField = value; + debtRepaymentSet = true; + } + } + public advancedFraudChecksType advancedFraudChecks; + public wallet wallet; + private processingType processingTypeField; + private bool processingTypeSet; + + public processingType processingType + { + get { return processingTypeField; } + set { processingTypeField = value; processingTypeSet = true; } + } + + private string originalNetworkTransactionIdField; + private bool originalNetworkTransactionIdSet; + public string originalNetworkTransactionId + { + get { return originalNetworkTransactionIdField; } + set { originalNetworkTransactionIdField = value; originalNetworkTransactionIdSet = true; } + } + + private long originalTransactionAmountField; + private bool originalTxnAmountSet; + + public long originalTransactionAmount + { + get { return originalTransactionAmountField; } + set { originalTransactionAmountField = value; originalTxnAmountSet = true; } + } + + public override string Serialize() + { + string xml = "\r\n"; + if (litleTxnIdSet) + { + xml += "\r\n" + litleTxnIdField + ""; + } + else + { + xml += "\r\n" + SecurityElement.Escape(orderId) + ""; + xml += "\r\n" + amount + ""; + if (secondaryAmountSet) xml += "\r\n" + secondaryAmountField + ""; + if (surchargeAmountSet) xml += "\r\n" + surchargeAmountField + ""; + if (orderSource != null) xml += "\r\n" + orderSource.Serialize() + ""; + + if (customerInfo != null) + { + xml += "\r\n" + customerInfo.Serialize() + "\r\n"; + } + if (billToAddress != null) + { + xml += "\r\n" + billToAddress.Serialize() + "\r\n"; + } + if (shipToAddress != null) + { + xml += "\r\n" + shipToAddress.Serialize() + "\r\n"; + } + if (card != null) + { + xml += "\r\n" + card.Serialize() + "\r\n"; + } + else if (paypal != null) + { + xml += "\r\n" + paypal.Serialize() + "\r\n"; + } + else if (mpos != null) + { + xml += "\r\n" + mpos.Serialize() + "\r\n"; + } + else if (token != null) + { + xml += "\r\n" + token.Serialize() + "\r\n"; + } + else if (paypage != null) + { + xml += "\r\n" + paypage.Serialize() + "\r\n"; + } + else if (applepay != null) + { + xml += "\r\n" + applepay.Serialize() + "\r\n"; + } + if (billMeLaterRequest != null) + { + xml += "\r\n" + billMeLaterRequest.Serialize() + "\r\n"; + } + if (cardholderAuthentication != null) + { + xml += "\r\n" + cardholderAuthentication.Serialize() + "\r\n"; + } + if (processingInstructions != null) + { + xml += "\r\n" + processingInstructions.Serialize() + "\r\n"; + } + if (pos != null) + { + xml += "\r\n" + pos.Serialize() + "\r\n"; + } + if (customBilling != null) + { + xml += "\r\n" + customBilling.Serialize() + "\r\n"; + } + if (taxTypeSet) + { + xml += "\r\n" + taxTypeField + ""; + } + if (enhancedData != null) + { + xml += "\r\n" + enhancedData.Serialize() + "\r\n"; + } + if (amexAggregatorData != null) + { + xml += "\r\n" + amexAggregatorData.Serialize() + "\r\n"; + } + if (allowPartialAuthSet) + { + xml += "\r\n" + allowPartialAuthField.ToString().ToLower() + ""; + } + if (healthcareIIAS != null) + { + xml += "\r\n" + healthcareIIAS.Serialize() + "\r\n"; + } + if (filtering != null) + { + xml += "\r\n" + filtering.Serialize() + "\r\n"; + } + if (merchantData != null) + { + xml += "\r\n" + merchantData.Serialize() + "\r\n"; + } + if (recyclingRequest != null) + { + xml += "\r\n" + recyclingRequest.Serialize() + "\r\n"; + } + if (fraudFilterOverrideSet) xml += "\r\n" + fraudFilterOverrideField.ToString().ToLower() + ""; + if (recurringRequest != null) + { + xml += "\r\n" + recurringRequest.Serialize() + "\r\n"; + } + if (debtRepaymentSet) xml += "\r\n" + debtRepayment.ToString().ToLower() + ""; + if (advancedFraudChecks != null) + { + xml += "\r\n" + advancedFraudChecks.Serialize() + "\r\n"; + } + if (wallet != null) + { + xml += "\r\n" + wallet.Serialize() + "\r\n"; + } + if (processingTypeSet) + { + xml += "\r\n" + processingType + ""; + } + if (originalNetworkTransactionIdSet) + { + xml += "\r\n" + originalNetworkTransactionId + ""; + } + if (originalTxnAmountSet) + { + xml += "\r\n" + originalTransactionAmount + ""; + } + } + + xml += "\r\n"; + return xml; + } + } + + public partial class sale : transactionTypeWithReportGroup + { + + private long litleTxnIdField; + private bool litleTxnIdSet; + public long litleTxnId + { + get + { + return litleTxnIdField; + } + set + { + litleTxnIdField = value; + litleTxnIdSet = true; + } + } + public string orderId; + public long amount; + private bool secondaryAmountSet; + private long secondaryAmountField; + public long secondaryAmount + { + get { return secondaryAmountField; } + set { secondaryAmountField = value; secondaryAmountSet = true; } + } + private bool surchargeAmountSet; + private long surchargeAmountField; + public long surchargeAmount + { + get { return surchargeAmountField; } + set { surchargeAmountField = value; surchargeAmountSet = true; } + } + public orderSourceType orderSource; + public customerInfo customerInfo; + public contact billToAddress; + public contact shipToAddress; + public cardType card; + public mposType mpos; + public payPal paypal; + public cardTokenType token; + public cardPaypageType paypage; + public applepayType applepay; + public sepaDirectDebitType sepaDirectDebit; + public idealType ideal; + public billMeLaterRequest billMeLaterRequest; + public fraudCheckType cardholderAuthentication; + public customBilling customBilling; + private govtTaxTypeEnum taxTypeField; + private bool taxTypeSet; + public govtTaxTypeEnum taxType + { + get { return taxTypeField; } + set { taxTypeField = value; taxTypeSet = true; } + } + public enhancedData enhancedData; + public processingInstructions processingInstructions; + public pos pos; + private bool payPalOrderCompleteField; + private bool payPalOrderCompleteSet; + public bool payPalOrderComplete + { + get { return payPalOrderCompleteField; } + set { payPalOrderCompleteField = value; payPalOrderCompleteSet = true; } + } + public string payPalNotes; + public amexAggregatorData amexAggregatorData; + private bool allowPartialAuthField; + private bool allowPartialAuthSet; + public bool allowPartialAuth + { + get + { + return allowPartialAuthField; + } + set + { + allowPartialAuthField = value; + allowPartialAuthSet = true; + } + } + public healthcareIIAS healthcareIIAS; + public filteringType filtering; + public merchantDataType merchantData; + public recyclingRequestType recyclingRequest; + private bool fraudFilterOverrideField; + private bool fraudFilterOverrideSet; + public bool fraudFilterOverride + { + get + { + return fraudFilterOverrideField; + } + set + { + fraudFilterOverrideField = value; + fraudFilterOverrideSet = true; + } + } + public recurringRequest recurringRequest; + public litleInternalRecurringRequest litleInternalRecurringRequest; + private bool debtRepaymentField; + private bool debtRepaymentSet; + public bool debtRepayment + { + get + { + return debtRepaymentField; + } + set + { + debtRepaymentField = value; + debtRepaymentSet = true; + } + } + public advancedFraudChecksType advancedFraudChecks; + public wallet wallet; + + private processingType processingTypeField; + private bool processingTypeSet; + public processingType processingType + { + get { return processingTypeField; } + set { processingTypeField = value; processingTypeSet = true; } + } + + private string originalNetworkTransactionIdField; + private bool originalNetworkTxnSet; + public string originalNetworkTransactionId + { + get { return originalNetworkTransactionIdField;} + set { originalNetworkTransactionIdField = value; originalNetworkTxnSet = true; } + } + + private long originalTransactionAmountField; + private bool originalTxnAmountSet; + public long originalTransactionAmount + { + get { return originalTransactionAmountField; } + set { originalTransactionAmountField = value; originalTxnAmountSet = true; } + } + + public override string Serialize() + { + string xml = "\r\n"; + if (litleTxnIdSet) xml += "\r\n" + litleTxnIdField + ""; + xml += "\r\n" + orderId + ""; + xml += "\r\n" + amount + ""; + if (secondaryAmountSet) xml += "\r\n" + secondaryAmountField + ""; + if (surchargeAmountSet) xml += "\r\n" + surchargeAmountField + ""; + if (orderSource != null) xml += "\r\n" + orderSource.Serialize() + ""; + if (customerInfo != null) + { + xml += "\r\n" + customerInfo.Serialize() + "\r\n"; + } + if (billToAddress != null) + { + xml += "\r\n" + billToAddress.Serialize() + "\r\n"; + } + if (shipToAddress != null) + { + xml += "\r\n" + shipToAddress.Serialize() + "\r\n"; + } + if (card != null) + { + xml += "\r\n" + card.Serialize() + "\r\n"; + } + else if (paypal != null) + { + xml += "\r\n" + paypal.Serialize() + "\r\n"; + } + else if (token != null) + { + xml += "\r\n" + token.Serialize() + "\r\n"; + } + else if (mpos != null) + { + xml += "\r\n" + mpos.Serialize() + ""; + } + else if (paypage != null) + { + xml += "\r\n" + paypage.Serialize() + "\r\n"; + } + else if (applepay != null) + { + xml += "\r\n" + applepay.Serialize() + "\r\n"; + } + else if (sepaDirectDebit != null) + { + xml += "\r\n" + sepaDirectDebit.Serialize() + "\r\n"; + } + else if (ideal != null) + { + xml += "\r\n" + ideal.Serialize() + "\r\n"; + } + if (billMeLaterRequest != null) + { + xml += "\r\n" + billMeLaterRequest.Serialize() + "\r\n"; + } + if (cardholderAuthentication != null) + { + xml += "\r\n" + cardholderAuthentication.Serialize() + "\r\n"; + } + if (customBilling != null) + { + xml += "\r\n" + customBilling.Serialize() + "\r\n"; + } + if (taxTypeSet) + { + xml += "\r\n" + taxTypeField + ""; + } + if (enhancedData != null) + { + xml += "\r\n" + enhancedData.Serialize() + "\r\n"; + } + if (processingInstructions != null) + { + xml += "\r\n" + processingInstructions.Serialize() + "\r\n"; + } + if (pos != null) + { + xml += "\r\n" + pos.Serialize() + "\r\n"; + } + if (payPalOrderCompleteSet) xml += "\r\n" + payPalOrderCompleteField.ToString().ToLower() + ""; + if (payPalNotes != null) xml += "\r\n" + SecurityElement.Escape(payPalNotes) + ""; + if (amexAggregatorData != null) + { + xml += "\r\n" + amexAggregatorData.Serialize() + "\r\n"; + } + if (allowPartialAuthSet) + { + xml += "\r\n" + allowPartialAuthField.ToString().ToLower() + ""; + } + if (healthcareIIAS != null) + { + xml += "\r\n" + healthcareIIAS.Serialize() + "\r\n"; + } + if (filtering != null) + { + xml += "\r\n" + filtering.Serialize() + "\r\n"; + } + if (merchantData != null) + { + xml += "\r\n" + merchantData.Serialize() + "\r\n"; + } + if (recyclingRequest != null) + { + xml += "\r\n" + recyclingRequest.Serialize() + "\r\n"; + } + if (fraudFilterOverrideSet) xml += "\r\n" + fraudFilterOverrideField.ToString().ToLower() + ""; + if (recurringRequest != null) + { + xml += "\r\n" + recurringRequest.Serialize() + "\r\n"; + } + if (litleInternalRecurringRequest != null) + { + xml += "\r\n" + litleInternalRecurringRequest.Serialize() + "\r\n"; + } + if (debtRepaymentSet) xml += "\r\n" + debtRepayment.ToString().ToLower() + ""; + if (advancedFraudChecks != null) xml += "\r\n" + advancedFraudChecks.Serialize() + "\r\n"; + if (wallet != null) + { + xml += "\r\n" + wallet.Serialize() + "\r\n"; + } + if (processingTypeSet) + { + xml += "\r\n" + processingType + ""; + } + if (originalNetworkTxnSet) + { + xml += "\r\n" + originalNetworkTransactionId + ""; + } + if (originalTxnAmountSet) + { + xml += "\r\n" + originalTransactionAmount + ""; + } + xml += "\r\n"; + return xml; + } + } + + public class forceCapture : transactionTypeWithReportGroup + { + public string orderId; + public long amount; + private bool secondaryAmountSet; + private long secondaryAmountField; + public long secondaryAmount + { + get { return secondaryAmountField; } + set { secondaryAmountField = value; secondaryAmountSet = true; } + } + private bool surchargeAmountSet; + private long surchargeAmountField; + public long surchargeAmount + { + get { return surchargeAmountField; } + set { surchargeAmountField = value; surchargeAmountSet = true; } + } + public orderSourceType orderSource; + public contact billToAddress; + public cardType card; + public mposType mpos; + public cardTokenType token; + public cardPaypageType paypage; + public customBilling customBilling; + private govtTaxTypeEnum taxTypeField; + private bool taxTypeSet; + public govtTaxTypeEnum taxType + { + get { return taxTypeField; } + set { taxTypeField = value; taxTypeSet = true; } + } + public enhancedData enhancedData; + public processingInstructions processingInstructions; + public pos pos; + public amexAggregatorData amexAggregatorData; + public merchantDataType merchantData; + private bool debtRepaymentField; + private bool debtRepaymentSet; + public bool debtRepayment + { + get { return debtRepaymentField; } + set { debtRepaymentField = value; debtRepaymentSet = true; } + } + + private processingType processingTypeField; + private bool processingTypeSet; + public processingType processingType + { + get { return processingTypeField; } + set { processingTypeField = value; processingTypeSet = true; } + } + + public override string Serialize() + { + var xml = "\r\n"; + xml += "\r\n" + SecurityElement.Escape(orderId) + ""; + xml += "\r\n" + amount + ""; + if (secondaryAmountSet) xml += "\r\n" + secondaryAmountField + ""; + if (surchargeAmountSet) xml += "\r\n" + surchargeAmountField + ""; + if (orderSource != null) xml += "\r\n" + orderSource.Serialize() + ""; + if (billToAddress != null) + { + xml += "\r\n" + billToAddress.Serialize() + "\r\n"; + } + if (card != null) + { + xml += "\r\n" + card.Serialize() + "\r\n"; + } + else if (token != null) + { + xml += "\r\n" + token.Serialize() + "\r\n"; + } + else if (mpos != null) + { + xml += "\r\n" + mpos.Serialize() + ""; + } + else if (paypage != null) + { + xml += "\r\n" + paypage.Serialize() + "\r\n"; + } + if (customBilling != null) + { + xml += "\r\n" + customBilling.Serialize() + "\r\n"; + } + if (taxTypeSet) + { + xml += "\r\n" + taxTypeField + ""; + } + if (enhancedData != null) + { + xml += "\r\n" + enhancedData.Serialize() + "\r\n"; + } + if (processingInstructions != null) + { + xml += "\r\n" + processingInstructions.Serialize() + "\r\n"; + } + if (pos != null) + { + xml += "\r\n" + pos.Serialize() + "\r\n"; + } + if (amexAggregatorData != null) + { + xml += "\r\n" + amexAggregatorData.Serialize() + "\r\n"; + } + if (merchantData != null) + { + xml += "\r\n" + merchantData.Serialize() + "\r\n"; + } + if (debtRepaymentSet) xml += "\r\n" + debtRepayment.ToString().ToLower() + ""; + if (processingTypeSet) + { + xml += "\r\n" + processingType + ""; + } + xml += "\r\n"; + return xml; + } + } + + public class captureGivenAuth : transactionTypeWithReportGroup + { + public string orderId; + public authInformation authInformation; + public long amount; + private bool secondaryAmountSet; + private long secondaryAmountField; + public long secondaryAmount + { + get { return secondaryAmountField; } + set { secondaryAmountField = value; secondaryAmountSet = true; } + } + private bool surchargeAmountSet; + private long surchargeAmountField; + public long surchargeAmount + { + get { return surchargeAmountField; } + set { surchargeAmountField = value; surchargeAmountSet = true; } + } + public orderSourceType orderSource; + public contact billToAddress; + public contact shipToAddress; + public cardType card; + public mposType mpos; + public cardTokenType token; + public cardPaypageType paypage; + public customBilling customBilling; + + private govtTaxTypeEnum taxTypeField; + private bool taxTypeSet; + public govtTaxTypeEnum taxType + { + get { return taxTypeField; } + set { taxTypeField = value; taxTypeSet = true; } + } + + public billMeLaterRequest billMeLaterRequest; + public enhancedData enhancedData; + public processingInstructions processingInstructions; + public pos pos; + public amexAggregatorData amexAggregatorData; + public merchantDataType merchantData; + + private bool debtRepaymentField; + private bool debtRepaymentSet; + public bool debtRepayment + { + get { return debtRepaymentField; } + set { debtRepaymentField = value; debtRepaymentSet = true; } + } + + private processingType processingTypeField; + private bool processingTypeSet; + public processingType processingType + { + get { return processingTypeField; } + set { processingTypeField = value; processingTypeSet = true; } + } + + private string originalNetworkTransactionIdField; + private bool originalNetworkTransactionIdSet; + public string originalNetworkTransactionId + { + get { return originalNetworkTransactionIdField; } + set { originalNetworkTransactionIdField = value; originalNetworkTransactionIdSet = true; } + } + + private long originalTransactionAmountField; + private bool originalTransactionAmountSet; + public long originalTransactionAmount + { + get { return originalTransactionAmountField; } + set { originalTransactionAmountField = value; originalTransactionAmountSet = true; } + } + + public override string Serialize() + { + var xml = "\r\n"; + xml += "\r\n" + SecurityElement.Escape(orderId) + ""; + if (authInformation != null) xml += "\r\n" + authInformation.Serialize() + "\r\n"; + xml += "\r\n" + amount + ""; + if (secondaryAmountSet) xml += "\r\n" + secondaryAmountField + ""; + if (surchargeAmountSet) xml += "\r\n" + surchargeAmountField + ""; + if (orderSource != null) xml += "\r\n" + orderSource.Serialize() + ""; + if (billToAddress != null) + { + xml += "\r\n" + billToAddress.Serialize() + "\r\n"; + } + if (shipToAddress != null) + { + xml += "\r\n" + shipToAddress.Serialize() + "\r\n"; + } + if (card != null) + { + xml += "\r\n" + card.Serialize() + "\r\n"; + } + else if (token != null) + { + xml += "\r\n" + token.Serialize() + "\r\n"; + } + else if (mpos != null) + { + xml += "\r\n" + mpos.Serialize() + ""; + } + else if (paypage != null) + { + xml += "\r\n" + paypage.Serialize() + "\r\n"; + } + if (customBilling != null) + { + xml += "\r\n" + customBilling.Serialize() + "\r\n"; + } + if (taxTypeSet) + { + xml += "\r\n" + taxTypeField + ""; + } + if (billMeLaterRequest != null) + { + xml += "\r\n" + billMeLaterRequest.Serialize() + "\r\n"; + } + if (enhancedData != null) + { + xml += "\r\n" + enhancedData.Serialize() + "\r\n"; + } + if (processingInstructions != null) + { + xml += "\r\n" + processingInstructions.Serialize() + "\r\n"; + } + if (pos != null) + { + xml += "\r\n" + pos.Serialize() + "\r\n"; + } + if (amexAggregatorData != null) + { + xml += "\r\n" + amexAggregatorData.Serialize() + "\r\n"; + } + if (merchantData != null) + { + xml += "\r\n" + merchantData.Serialize() + "\r\n"; + } + if (debtRepaymentSet) xml += "\r\n" + debtRepayment.ToString().ToLower() + ""; + if (processingTypeSet) + { + xml += "\r\n" + processingType + ""; + } + if (originalNetworkTransactionIdSet) + { + xml += "\r\n" + originalNetworkTransactionId + ""; + } + if (originalTransactionAmountSet) + { + xml += "\r\n" + originalTransactionAmount + ""; + } + xml += "\r\n"; + return xml; + } + } + + public partial class cancelSubscription : recurringTransactionType + { + private long subscriptionIdField; + private bool subscriptionIdSet; + public long subscriptionId + { + get + { + return subscriptionIdField; + } + set + { + subscriptionIdField = value; + subscriptionIdSet = true; + } + } + + public override string Serialize() + { + string xml = "\r\n"; + if (subscriptionIdSet) xml += "\r\n" + subscriptionIdField + ""; + xml += "\r\n"; + return xml; + } + } + + [SerializableAttribute()] + [XmlTypeAttribute(Namespace = "http://www.litle.com/schema")] + public enum intervalType + { + ANNUAL, + SEMIANNUAL, + QUARTERLY, + MONTHLY, + WEEKLY + } + + [SerializableAttribute()] + [XmlTypeAttribute(Namespace = "http://www.litle.com/schema")] + public enum trialIntervalType + { + MONTH, + DAY + } + + public partial class createPlan : recurringTransactionType + { + public string planCode; + public string name; + + private string descriptionField; + private bool descriptionSet; + public string description + { + get { return descriptionField; } + set { descriptionField = value; descriptionSet = true; } + } + + public intervalType intervalType; + public long amount; + + public int numberOfPaymentsField; + public bool numberOfPaymentsSet; + public int numberOfPayments + { + get { return numberOfPaymentsField; } + set { numberOfPaymentsField = value; numberOfPaymentsSet = true; } + } + + public int trialNumberOfIntervalsField; + public bool trialNumberOfIntervalsSet; + public int trialNumberOfIntervals + { + get { return trialNumberOfIntervalsField; } + set { trialNumberOfIntervalsField = value; trialNumberOfIntervalsSet = true; } + } + + private trialIntervalType trialIntervalTypeField; + private bool trialIntervalTypeSet; + public trialIntervalType trialIntervalType + { + get { return trialIntervalTypeField; } + set { trialIntervalTypeField = value; trialIntervalTypeSet = true; } + } + + private bool activeField; + private bool activeSet; + public bool active + { + get { return activeField; } + set { activeField = value; activeSet = true; } + } + + public override string Serialize() + { + string xml = "\r\n"; + xml += "\r\n" + SecurityElement.Escape(planCode) + ""; + xml += "\r\n" + SecurityElement.Escape(name) + ""; + if (descriptionSet) xml += "\r\n" + SecurityElement.Escape(descriptionField) + ""; + xml += "\r\n" + intervalType + ""; + xml += "\r\n" + amount + ""; + if (numberOfPaymentsSet) xml += "\r\n" + numberOfPaymentsField + ""; + if (trialNumberOfIntervalsSet) xml += "\r\n" + trialNumberOfIntervalsField + ""; + if (trialIntervalTypeSet) xml += "\r\n" + trialIntervalTypeField + ""; + if (activeSet) xml += "\r\n" + activeField.ToString().ToLower() + ""; + xml += "\r\n"; + return xml; + } + } + + public partial class updatePlan : recurringTransactionType + { + public string planCode; + + private bool activeField; + private bool activeSet; + public bool active + { + get { return activeField; } + set { activeField = value; activeSet = true; } + } + + public override string Serialize() + { + string xml = "\r\n"; + xml += "\r\n" + SecurityElement.Escape(planCode) + ""; + if (activeSet) xml += "\r\n" + activeField.ToString().ToLower() + ""; + xml += "\r\n"; + return xml; + } + } + public partial class updateSubscription : recurringTransactionType + { + private long subscriptionIdField; + private bool subscriptionIdSet; + public long subscriptionId + { + get + { + return subscriptionIdField; + } + set + { + subscriptionIdField = value; + subscriptionIdSet = true; + } + } + + public string planCode; + public contact billToAddress; + public cardType card; + public cardTokenType token; + public cardPaypageType paypage; + private DateTime billingDateField; + private bool billingDateSet; + public DateTime billingDate + { + get + { + return billingDateField; + } + set + { + billingDateField = value; + billingDateSet = true; + } + } + + public List createDiscounts; + public List updateDiscounts; + public List deleteDiscounts; + public List createAddOns; + public List updateAddOns; + public List deleteAddOns; + + public updateSubscription() + { + createDiscounts = new List(); + updateDiscounts = new List(); + deleteDiscounts = new List(); + createAddOns = new List(); + updateAddOns = new List(); + deleteAddOns = new List(); + } + + public override string Serialize() + { + string xml = "\r\n"; + if (subscriptionIdSet) xml += "\r\n" + subscriptionIdField + ""; + if (planCode != null) xml += "\r\n" + SecurityElement.Escape(planCode) + ""; + if (billToAddress != null) xml += "\r\n" + billToAddress.Serialize() + "\r\n"; + if (card != null) xml += "\r\n" + card.Serialize() + "\r\n"; + else if (token != null) xml += "\r\n" + token.Serialize() + "\r\n"; + else if (paypage != null) xml += "\r\n" + paypage.Serialize() + "\r\n"; + if (billingDateSet) xml += "\r\n" + XmlUtil.toXsdDate(billingDateField) + ""; + foreach (createDiscount createDiscount in createDiscounts) + { + xml += "\r\n" + createDiscount.Serialize() + "\r\n"; + } + foreach (updateDiscount updateDiscount in updateDiscounts) + { + xml += "\r\n" + updateDiscount.Serialize() + "\r\n"; + } + foreach (deleteDiscount deleteDiscount in deleteDiscounts) + { + xml += "\r\n" + deleteDiscount.Serialize() + "\r\n"; + } + foreach (createAddOn createAddOn in createAddOns) + { + xml += "\r\n" + createAddOn.Serialize() + "\r\n"; + } + foreach (updateAddOn updateAddOn in updateAddOns) + { + xml += "\r\n" + updateAddOn.Serialize() + "\r\n"; + } + foreach (deleteAddOn deleteAddOn in deleteAddOns) + { + xml += "\r\n" + deleteAddOn.Serialize() + "\r\n"; + } + xml += "\r\n"; + return xml; + } + } + + public partial class fraudResult + { + public string Serialize() + { + string xml = ""; + if (avsResult != null) xml += "\r\n" + SecurityElement.Escape(avsResult) + ""; + if (cardValidationResult != null) xml += "\r\n" + SecurityElement.Escape(cardValidationResult) + ""; + if (authenticationResult != null) xml += "\r\n" + SecurityElement.Escape(authenticationResult) + ""; + if (advancedAVSResult != null) xml += "\r\n" + SecurityElement.Escape(advancedAVSResult) + ""; + return xml; + } + } + + public partial class authInformation + { + public DateTime authDate; + public string authCode; + public fraudResult fraudResult; + private long authAmountField; + private bool authAmountSet; + public long authAmount + { + get { return authAmountField; } + set { authAmountField = value; authAmountSet = true; } + } + + public string Serialize() + { + string xml = ""; + if (authDate != null) xml += "\r\n" + XmlUtil.toXsdDate(authDate) + ""; + if (authCode != null) xml += "\r\n" + SecurityElement.Escape(authCode) + ""; + if (fraudResult != null) xml += "\r\n" + fraudResult.Serialize() + ""; + if (authAmountSet) xml += "\r\n" + authAmountField + ""; + return xml; + } + } + + public class XmlUtil + { + public static string toXsdDate(DateTime dateTime) + { + string year = dateTime.Year.ToString(); + string month = dateTime.Month.ToString(); + if (dateTime.Month < 10) + { + month = "0" + month; + } + string day = dateTime.Day.ToString(); + if (dateTime.Day < 10) + { + day = "0" + day; + } + return year + "-" + month + "-" + day; + } + } + + public partial class recyclingRequestType + { + private recycleByTypeEnum recycleByField; + private bool recycleBySet; + public recycleByTypeEnum recycleBy + { + get { return recycleByField; } + set { recycleByField = value; recycleBySet = true; } + } + public string recycleId; + + public string Serialize() + { + string xml = ""; + if (recycleBySet) xml += "\r\n" + recycleByField + ""; + if (recycleId != null) xml += "\r\n" + SecurityElement.Escape(recycleId) + ""; + return xml; + } + } + + public partial class litleInternalRecurringRequest + { + public string subscriptionId; + public string recurringTxnId; + + private bool finalPaymentField; + private bool finalPaymentSet; + public bool finalPayment + { + get { return finalPaymentField; } + set { finalPaymentField = value; finalPaymentSet = true; } + } + + public string Serialize() + { + string xml = ""; + if (subscriptionId != null) xml += "\r\n" + SecurityElement.Escape(subscriptionId) + ""; + if (recurringTxnId != null) xml += "\r\n" + SecurityElement.Escape(recurringTxnId) + ""; + if(finalPaymentSet) xml += "\r\n" + finalPaymentField.ToString().ToLower() + ""; + return xml; + } + } + + public partial class createDiscount + { + public string discountCode; + public string name; + public long amount; + public DateTime startDate; + public DateTime endDate; + + public string Serialize() + { + string xml = ""; + xml += "\r\n" + SecurityElement.Escape(discountCode) + ""; + xml += "\r\n" + SecurityElement.Escape(name) + ""; + xml += "\r\n" + amount + ""; + xml += "\r\n" + XmlUtil.toXsdDate(startDate) + ""; + xml += "\r\n" + XmlUtil.toXsdDate(endDate) + ""; + return xml; + } + } + + public partial class updateDiscount + { + public string discountCode; + + private string nameField; + private bool nameSet; + public string name + { + get { return nameField; } + set { nameField = value; nameSet = true; } + } + + private long amountField; + private bool amountSet; + public long amount + { + get { return amountField; } + set { amountField = value; amountSet = true; } + } + + private DateTime startDateField; + private bool startDateSet; + public DateTime startDate + { + get { return startDateField; } + set { startDateField = value; startDateSet = true; } + } + + private DateTime endDateField; + private bool endDateSet; + public DateTime endDate + { + get { return endDateField; } + set { endDateField = value; endDateSet = true; } + } + + public string Serialize() + { + string xml = ""; + xml += "\r\n" + SecurityElement.Escape(discountCode) + ""; + if (nameSet) xml += "\r\n" + SecurityElement.Escape(nameField) + ""; + if (amountSet) xml += "\r\n" + amountField + ""; + if (startDateSet) xml += "\r\n" + XmlUtil.toXsdDate(startDateField) + ""; + if (endDateSet) xml += "\r\n" + XmlUtil.toXsdDate(endDateField) + ""; + return xml; + } + } + + public partial class deleteDiscount + { + public string discountCode; + + public string Serialize() + { + string xml = ""; + xml += "\r\n" + SecurityElement.Escape(discountCode) + ""; + return xml; + } + } + + public partial class createAddOn + { + public string addOnCode; + public string name; + public long amount; + public DateTime startDate; + public DateTime endDate; + + public string Serialize() + { + string xml = ""; + xml += "\r\n" + SecurityElement.Escape(addOnCode) + ""; + xml += "\r\n" + SecurityElement.Escape(name) + ""; + xml += "\r\n" + amount + ""; + xml += "\r\n" + XmlUtil.toXsdDate(startDate) + ""; + xml += "\r\n" + XmlUtil.toXsdDate(endDate) + ""; + return xml; + } + } + + public partial class updateAddOn + { + public string addOnCode; + + private string nameField; + private bool nameSet; + public string name + { + get { return nameField; } + set { nameField = value; nameSet = true; } + } + + private long amountField; + private bool amountSet; + public long amount + { + get { return amountField; } + set { amountField = value; amountSet = true; } + } + + private DateTime startDateField; + private bool startDateSet; + public DateTime startDate + { + get { return startDateField; } + set { startDateField = value; startDateSet = true; } + } + + private DateTime endDateField; + private bool endDateSet; + public DateTime endDate + { + get { return endDateField; } + set { endDateField = value; endDateSet = true; } + } + + public string Serialize() + { + string xml = ""; + xml += "\r\n" + SecurityElement.Escape(addOnCode) + ""; + if (nameSet) xml += "\r\n" + SecurityElement.Escape(nameField) + ""; + if (amountSet) xml += "\r\n" + amountField + ""; + if (startDateSet) xml += "\r\n" + XmlUtil.toXsdDate(startDateField) + ""; + if (endDateSet) xml += "\r\n" + XmlUtil.toXsdDate(endDateField) + ""; + return xml; + } + } + + public partial class deleteAddOn + { + public string addOnCode; + + public string Serialize() + { + string xml = ""; + xml += "\r\n" + SecurityElement.Escape(addOnCode) + ""; + return xml; + } + } + + + public partial class subscription + { + public string planCode; + private bool numberOfPaymentsSet; + private int numberOfPaymentsField; + public int numberOfPayments + { + get { return numberOfPaymentsField; } + set { numberOfPaymentsField = value; numberOfPaymentsSet = true; } + } + private bool startDateSet; + private DateTime startDateField; + public DateTime startDate + { + get { return startDateField; } + set { startDateField = value; startDateSet = true; } + } + private bool amountSet; + private long amountField; + public long amount + { + get { return amountField; } + set { amountField = value; amountSet = true; } + } + + public List createDiscounts; + public List createAddOns; + + public subscription() + { + createDiscounts = new List(); + createAddOns = new List(); + } + + + public string Serialize() + { + string xml = ""; + xml += "\r\n" + planCode + ""; + if(numberOfPaymentsSet) xml += "\r\n" + numberOfPayments + ""; + if (startDateSet) xml += "\r\n" + XmlUtil.toXsdDate(startDateField) + ""; + if(amountSet) xml += "\r\n" + amountField + ""; + foreach(createDiscount createDiscount in createDiscounts) + { + xml += "\r\n" + createDiscount.Serialize() + "\r\n"; + } + foreach (createAddOn createAddOn in createAddOns) + { + xml += "\r\n" + createAddOn.Serialize() + "\r\n"; + } + + return xml; + } + } + + + + + + public partial class filteringType + { + private bool prepaidField; + private bool prepaidSet; + public bool prepaid + { + get { return prepaidField; } + set { prepaidField = value; prepaidSet = true; } + } + + private bool internationalField; + private bool internationalSet; + public bool international + { + get { return internationalField; } + set { internationalField = value; internationalSet = true; } + } + + private bool chargebackField; + private bool chargebackSet; + public bool chargeback + { + get { return chargebackField; } + set { chargebackField = value; chargebackSet = true; } + } + + public string Serialize() + { + string xml = ""; + if (prepaidSet) xml += "\r\n" + prepaidField.ToString().ToLower() + ""; + if (internationalSet) xml += "\r\n" + internationalField.ToString().ToLower() + ""; + if (chargebackSet) xml += "\r\n" + chargebackField.ToString().ToLower() + ""; + return xml; + } + + } + + public partial class healthcareIIAS + { + public healthcareAmounts healthcareAmounts; + private IIASFlagType IIASFlagField; + private bool IIASFlagSet; + public IIASFlagType IIASFlag + { + get { return IIASFlagField; } + set { IIASFlagField = value; IIASFlagSet = true; } + } + + public string Serialize() + { + string xml = ""; + if (healthcareAmounts != null) xml += "\r\n" + healthcareAmounts.Serialize() + ""; + if (IIASFlagSet) xml += "\r\n" + IIASFlagField + ""; + return xml; + } + } + + public partial class recurringRequest + { + public subscription subscription; + + public string Serialize() + { + string xml = ""; + if (subscription != null) xml += "\r\n" + subscription.Serialize() + "\r\n"; + return xml; + } + } + + + public partial class healthcareAmounts + { + private int totalHealthcareAmountField; + private bool totalHealthcareAmountSet; + public int totalHealthcareAmount + { + get { return totalHealthcareAmountField; } + set { totalHealthcareAmountField = value; totalHealthcareAmountSet = true; } + } + + private int RxAmountField; + private bool RxAmountSet; + public int RxAmount + { + get { return RxAmountField; } + set { RxAmountField = value; RxAmountSet = true; } + } + + private int visionAmountField; + private bool visionAmountSet; + public int visionAmount + { + get { return visionAmountField; } + set { visionAmountField = value; visionAmountSet = true; } + } + + private int clinicOtherAmountField; + private bool clinicOtherAmountSet; + public int clinicOtherAmount + { + get { return clinicOtherAmountField; } + set { clinicOtherAmountField = value; clinicOtherAmountSet = true; } + } + + private int dentalAmountField; + private bool dentalAmountSet; + public int dentalAmount + { + get { return dentalAmountField; } + set { dentalAmountField = value; dentalAmountSet = true; } + } + + public string Serialize() + { + string xml = ""; + if (totalHealthcareAmountSet) xml += "\r\n" + totalHealthcareAmountField + ""; + if (RxAmountSet) xml += "\r\n" + RxAmountField + ""; + if (visionAmountSet) xml += "\r\n" + visionAmountField + ""; + if (clinicOtherAmountSet) xml += "\r\n" + clinicOtherAmountField + ""; + if (dentalAmountSet) xml += "\r\n" + dentalAmountField + ""; + return xml; + } + } + + public sealed class orderSourceType + { + public static readonly orderSourceType ecommerce = new orderSourceType("ecommerce"); + public static readonly orderSourceType installment = new orderSourceType("installment"); + public static readonly orderSourceType mailorder = new orderSourceType("mailorder"); + public static readonly orderSourceType recurring = new orderSourceType("recurring"); + public static readonly orderSourceType retail = new orderSourceType("retail"); + public static readonly orderSourceType telephone = new orderSourceType("telephone"); + public static readonly orderSourceType item3dsAuthenticated = new orderSourceType("3dsAuthenticated"); + public static readonly orderSourceType item3dsAttempted = new orderSourceType("3dsAttempted"); + public static readonly orderSourceType recurringtel = new orderSourceType("recurringtel"); + public static readonly orderSourceType echeckppd = new orderSourceType("echeckppd"); + public static readonly orderSourceType applepay = new orderSourceType("applepay"); + public static readonly orderSourceType androidpay = new orderSourceType("androidpay"); + + private orderSourceType(string value) { this.value = value; } + public string Serialize() { return value; } + private string value; + } + + public partial class contact + { + + public string name; + public string firstName; + public string middleInitial; + public string lastName; + public string companyName; + public string addressLine1; + public string addressLine2; + public string addressLine3; + public string city; + public string state; + public string zip; + private countryTypeEnum countryField; + private bool countrySpecified; + public countryTypeEnum country + { + get { return countryField; } + set { countryField = value; countrySpecified = true; } + } + public string email; + public string phone; + + public string Serialize() + { + string xml = ""; + if (name != null) xml += "\r\n" + SecurityElement.Escape(name) + ""; + if (firstName != null) xml += "\r\n" + SecurityElement.Escape(firstName) + ""; + if (middleInitial != null) xml += "\r\n" + SecurityElement.Escape(middleInitial) + ""; + if (lastName != null) xml += "\r\n" + SecurityElement.Escape(lastName) + ""; + if (companyName != null) xml += "\r\n" + SecurityElement.Escape(companyName) + ""; + if (addressLine1 != null) xml += "\r\n" + SecurityElement.Escape(addressLine1) + ""; + if (addressLine2 != null) xml += "\r\n" + SecurityElement.Escape(addressLine2) + ""; + if (addressLine3 != null) xml += "\r\n" + SecurityElement.Escape(addressLine3) + ""; + if (city != null) xml += "\r\n" + SecurityElement.Escape(city) + ""; + if (state != null) xml += "\r\n" + SecurityElement.Escape(state) + ""; + if (zip != null) xml += "\r\n" + SecurityElement.Escape(zip) + ""; + if (countrySpecified) xml += "\r\n" + countryField + ""; + if (email != null) xml += "\r\n" + SecurityElement.Escape(email) + ""; + if (phone != null) xml += "\r\n" + SecurityElement.Escape(phone) + ""; + return xml; + } + } + + public enum countryTypeEnum + { + + /// + USA, + AF, + AX, + AL, + DZ, + AS, + AD, + AO, + AI, + AQ, + AG, + AR, + AM, + AW, + AU, + AT, + AZ, + BS, + BH, + BD, + BB, + BY, + BE, + BZ, + BJ, + BM, + BT, + BO, + BQ, + BA, + BW, + BV, + BR, + IO, + BN, + BG, + BF, + BI, + KH, + CM, + CA, + CV, + KY, + CF, + TD, + CL, + CN, + CX, + CC, + CO, + KM, + CG, + CD, + CK, + CR, + CI, + HR, + CU, + CW, + CY, + CZ, + DK, + DJ, + DM, + DO, + TL, + EC, + EG, + SV, + GQ, + ER, + EE, + ET, + FK, + FO, + FJ, + FI, + FR, + GF, + PF, + TF, + GA, + GM, + GE, + DE, + GH, + GI, + GR, + GL, + GD, + GP, + GU, + GT, + GG, + GN, + GW, + GY, + HT, + HM, + HN, + HK, + HU, + IS, + IN, + ID, + IR, + IQ, + IE, + IM, + IL, + IT, + JM, + JP, + JE, + JO, + KZ, + KE, + KI, + KP, + KR, + KW, + KG, + LA, + LV, + LB, + LS, + LR, + LY, + LI, + LT, + LU, + MO, + MK, + MG, + MW, + MY, + MV, + ML, + MT, + MH, + MQ, + MR, + MU, + YT, + MX, + FM, + MD, + MC, + MN, + MS, + MA, + MZ, + MM, + NA, + NR, + NP, + NL, + AN, + NC, + NZ, + NI, + NE, + NG, + NU, + NF, + MP, + NO, + OM, + PK, + PW, + PS, + PA, + PG, + PY, + PE, + PH, + PN, + PL, + PT, + PR, + QA, + RE, + RO, + RU, + RW, + BL, + KN, + LC, + MF, + VC, + WS, + SM, + ST, + SA, + SN, + SC, + SL, + SG, + SX, + SK, + SI, + SB, + SO, + ZA, + GS, + ES, + LK, + SH, + PM, + SD, + SR, + SJ, + SZ, + SE, + CH, + SY, + TW, + TJ, + TZ, + TH, + TG, + TK, + TO, + TT, + TN, + TR, + TM, + TC, + TV, + UG, + UA, + AE, + GB, + US, + UM, + UY, + UZ, + VU, + VA, + VE, + VN, + VG, + VI, + WF, + EH, + YE, + ZM, + ZW, + RS, + ME, + } + + public partial class fraudCheckType + { + public string authenticationValue; + public string authenticationTransactionId; + public string customerIpAddress; + private bool authenticatedByMerchantField; + private bool authenticatedByMerchantSet; + public bool authenticatedByMerchant + { + get { return authenticatedByMerchantField; } + set { authenticatedByMerchantField = value; authenticatedByMerchantSet = true; } + } + + public string Serialize() + { + string xml = ""; + if (authenticationValue != null) xml += "\r\n" + SecurityElement.Escape(authenticationValue) + ""; + if (authenticationTransactionId != null) xml += "\r\n" + SecurityElement.Escape(authenticationTransactionId) + ""; + if (customerIpAddress != null) xml += "\r\n" + SecurityElement.Escape(customerIpAddress) + ""; + if (authenticatedByMerchantSet) xml += "\r\n" + authenticatedByMerchantField.ToString().ToLower() + ""; + return xml; + } + } + + public partial class advancedFraudChecksType + { + public string threatMetrixSessionId; + private string customAttribute1Field; + private bool customAttribute1Set; + public string customAttribute1 { + get { return customAttribute1Field; } + set { customAttribute1Field = value; customAttribute1Set = true; } + } + private string customAttribute2Field; + private bool customAttribute2Set; + public string customAttribute2 + { + get { return customAttribute2Field; } + set { customAttribute2Field = value; customAttribute2Set = true; } + } + private string customAttribute3Field; + private bool customAttribute3Set; + public string customAttribute3 + { + get { return customAttribute3Field; } + set { customAttribute3Field = value; customAttribute3Set = true; } + } + private string customAttribute4Field; + private bool customAttribute4Set; + public string customAttribute4 + { + get { return customAttribute4Field; } + set { customAttribute4Field = value; customAttribute4Set = true; } + } + private string customAttribute5Field; + private bool customAttribute5Set; + public string customAttribute5 + { + get { return customAttribute5Field; } + set { customAttribute5Field = value; customAttribute5Set = true; } + } + + public string Serialize() + { + string xml = ""; + if (threatMetrixSessionId != null) xml += "\r\n" + SecurityElement.Escape(threatMetrixSessionId) + ""; + if (customAttribute1Set) xml += "\r\n" + SecurityElement.Escape(customAttribute1Field) + ""; + if (customAttribute2Set) xml += "\r\n" + SecurityElement.Escape(customAttribute2Field) + ""; + if (customAttribute3Set) xml += "\r\n" + SecurityElement.Escape(customAttribute3Field) + ""; + if (customAttribute4Set) xml += "\r\n" + SecurityElement.Escape(customAttribute4Field) + ""; + if (customAttribute5Set) xml += "\r\n" + SecurityElement.Escape(customAttribute5Field) + ""; + return xml; + } + } + + public partial class mposType { + public string ksn; + public string formatId; + public string encryptedTrack; + public int track1Status; + public int track2Status; + + public string Serialize() + { + string xml = ""; + if (ksn != null) + { + xml += "\r\n" + ksn + ""; + } + if (formatId != null) + { + xml += "\r\n" + formatId + ""; + } + if (encryptedTrack != null) + { + xml += "\r\n" + SecurityElement.Escape(encryptedTrack) + ""; + } + if (track1Status == 0 || track1Status == 1 ) + { + xml += "\r\n" + track1Status + ""; + } + if (track2Status == 0 || track2Status == 1) + { + xml += "\r\n" + track2Status + ""; + } + + return xml; + } + } + + public class cardType + { + public methodOfPaymentTypeEnum type; + public string number; + public string expDate; + public string track; + public string cardValidationNum; + public string pin; + + public string Serialize() + { + var xml = ""; + if (track == null) + { + xml += "\r\n" + methodOfPaymentSerializer.Serialize(type) + ""; + if (number != null) + { + xml += "\r\n" + SecurityElement.Escape(number) + ""; + } + if (expDate != null) + { + xml += "\r\n" + SecurityElement.Escape(expDate) + ""; + } + } + else + { + xml += "\r\n" + SecurityElement.Escape(track) + ""; + } + if (cardValidationNum != null) + { + xml += "\r\n" + SecurityElement.Escape(cardValidationNum) + ""; + } + if (pin != null) + { + xml += "\r\n" + pin + ""; + } + return xml; + } + } + +// public class pinType +// { +// public string pin +// { +// get { return pin; } +// set { pin = value; } +// } +// +// public string Serialize() +// { +// string xml = ""; +// xml += "\r\n" + pin + ""; +// return xml; +// } +// } + + public partial class virtualGiftCardType + { + public int accountNumberLength + { + get { return accountNumberLengthField; } + set { accountNumberLengthField = value; accountNumberLengthSet = true; } + } + private int accountNumberLengthField; + private bool accountNumberLengthSet; + + public string giftCardBin; + + public string Serialize() + { + string xml = ""; + if (accountNumberLengthSet) xml += "\r\n" + accountNumberLengthField + ""; + if (giftCardBin != null) xml += "\r\n" + SecurityElement.Escape(giftCardBin) + ""; + return xml; + } + + } + + public partial class authReversal : transactionTypeWithReportGroup + { + public long litleTxnId; + private long amountField; + private bool amountSet; + public long amount + { + get { return amountField; } + set { amountField = value; amountSet = true; } + } + private bool surchargeAmountSet; + private long surchargeAmountField; + public long surchargeAmount + { + get { return surchargeAmountField; } + set { surchargeAmountField = value; surchargeAmountSet = true; } + } + public string payPalNotes; + public string actionReason; + + public override string Serialize() + { + string xml = "\r\n"; + xml += "\r\n" + litleTxnId + ""; + if (amountSet) + { + xml += "\r\n" + amountField + ""; + } + if (surchargeAmountSet) xml += "\r\n" + surchargeAmountField + ""; + if (payPalNotes != null) + { + xml += "\r\n" + SecurityElement.Escape(payPalNotes) + ""; + } + if (actionReason != null) + { + xml += "\r\n" + SecurityElement.Escape(actionReason) + ""; + } + xml += "\r\n"; + return xml; + } + + } + + public partial class echeckVoid : transactionTypeWithReportGroup + { + public long litleTxnId; + + public override string Serialize() + { + string xml = "\r\n"; + xml += "\r\n" + litleTxnId + ""; + xml += "\r\n"; + return xml; + } + + } + + public class accountUpdate : transactionTypeWithReportGroup + { + public string orderId; + public cardType card; + public cardTokenType token; + + public override string Serialize() + { + string xml = "\r\n"; + + xml += "\r\n" + SecurityElement.Escape(orderId) + ""; + + if (card != null) + { + xml += "\r\n"; + xml += card.Serialize(); + xml += "\r\n"; + } + else if (token != null) + { + xml += "\r\n"; + xml += token.Serialize(); + xml += "\r\n"; + } + + xml += "\r\n"; + + return xml; + } + } + + public class accountUpdateFileRequestData + { + public string merchantId; + public accountUpdateFileRequestData() + { + merchantId = Properties.Settings.Default.merchantId; + } + public accountUpdateFileRequestData(Dictionary config) + { + merchantId = config["merchantId"]; + } + public DateTime postDay; //yyyy-MM-dd + + public string Serialize() + { + string xml = "\r\n" + SecurityElement.Escape(merchantId) + ""; + + if (postDay != null) + { + xml += "\r\n" + postDay.ToString("yyyy-MM-dd") + ""; + } + + return xml; + } + } + + public partial class activate : transactionTypeWithReportGroup + { + public string orderId; + public long amount; + public orderSourceType orderSource; + public cardType card; + public virtualGiftCardType virtualGiftCard; + + public override string Serialize() + { + string xml = "\r\n"; + xml += "\r\n" + SecurityElement.Escape(orderId) + ""; + xml += "\r\n" + amount + ""; + xml += "\r\n" + orderSource.Serialize() + ""; + if (card != null) xml += "\r\n" + card.Serialize() + "\r\n"; + else if (virtualGiftCard != null) xml += "\r\n" + virtualGiftCard.Serialize() + "\r\n"; + xml += "\r\n"; + return xml; + } + } + + public partial class deactivate : transactionTypeWithReportGroup + { + public string orderId; + public orderSourceType orderSource; + public cardType card; + + public override string Serialize() + { + string xml = "\r\n"; + xml += "\r\n" + SecurityElement.Escape(orderId) + ""; + xml += "\r\n" + orderSource.Serialize() + ""; + xml += "\r\n" + card.Serialize() + "\r\n"; + xml += "\r\n"; + return xml; + } + } + + public partial class load : transactionTypeWithReportGroup + { + public string orderId; + public long amount; + public orderSourceType orderSource; + public cardType card; + + public override string Serialize() + { + string xml = "\r\n"; + xml += "\r\n" + SecurityElement.Escape(orderId) + ""; + xml += "\r\n" + amount + ""; + xml += "\r\n" + orderSource.Serialize() + ""; + xml += "\r\n" + card.Serialize() + "\r\n"; + xml += "\r\n"; + return xml; + } + } + + public partial class unload : transactionTypeWithReportGroup + { + public string orderId; + public long amount; + public orderSourceType orderSource; + public cardType card; + + public override string Serialize() + { + string xml = "\r\n"; + xml += "\r\n" + SecurityElement.Escape(orderId) + ""; + xml += "\r\n" + amount + ""; + xml += "\r\n" + orderSource.Serialize() + ""; + xml += "\r\n" + card.Serialize() + "\r\n"; + xml += "\r\n"; + return xml; + } + } + + public partial class balanceInquiry : transactionTypeWithReportGroup + { + public string orderId; + public orderSourceType orderSource; + public cardType card; + + public override string Serialize() + { + string xml = "\r\n"; + xml += "\r\n" + SecurityElement.Escape(orderId) + ""; + xml += "\r\n" + orderSource.Serialize() + ""; + xml += "\r\n" + card.Serialize() + "\r\n"; + xml += "\r\n"; + return xml; + } + } + + public partial class loadReversal : transactionTypeWithReportGroup + { + public string litleTxnId; + + public override string Serialize() + { + string xml = "\r\n"; + xml += "\r\n" + SecurityElement.Escape(litleTxnId) + ""; + xml += "\r\n"; + return xml; + } + } + + public partial class unloadReversal : transactionTypeWithReportGroup + { + public string litleTxnId; + + public override string Serialize() + { + string xml = "\r\n"; + xml += "\r\n" + SecurityElement.Escape(litleTxnId) + ""; + xml += "\r\n"; + return xml; + } + } + + public partial class deactivateReversal : transactionTypeWithReportGroup + { + public string litleTxnId; + + public override string Serialize() + { + string xml = "\r\n"; + xml += "\r\n" + SecurityElement.Escape(litleTxnId) + ""; + xml += "\r\n"; + return xml; + } + } + + public partial class activateReversal : transactionTypeWithReportGroup + { + public string litleTxnId; + + public override string Serialize() + { + string xml = "\r\n"; + xml += "\r\n" + SecurityElement.Escape(litleTxnId) + ""; + xml += "\r\n"; + return xml; + } + } + + public partial class refundReversal : transactionTypeWithReportGroup + { + public string litleTxnId; + + public override string Serialize() + { + string xml = "\r\n"; + xml += "\r\n" + SecurityElement.Escape(litleTxnId) + ""; + xml += "\r\n"; + return xml; + } + } + + public partial class depositReversal : transactionTypeWithReportGroup + { + public string litleTxnId; + + public override string Serialize() + { + string xml = "\r\n"; + xml += "\r\n" + SecurityElement.Escape(litleTxnId) + ""; + xml += "\r\n"; + return xml; + } + } + + public partial class applepayType + { + public string data; + public applepayHeaderType header; + public string signature; + public string version; + + public string Serialize() + { + string xml = ""; + if (data != null) xml += "\r\n" + SecurityElement.Escape(data) + ""; + if (header != null) xml += "\r\n
" + header.Serialize() + "
"; + if (signature != null) xml += "\r\n" + SecurityElement.Escape(signature) + ""; + if (version != null) xml += "\r\n" + SecurityElement.Escape(version) + ""; + return xml; + } + } + + public partial class sepaDirectDebitType + { + public string mandateProvider; + private sequenceType sequenceTypeCodeField; + private bool sequenceTypeCodeSet; + public sequenceType sequenceType + { + get { return sequenceTypeCodeField; } + set { sequenceTypeCodeField = value; sequenceTypeCodeSet = true; } + } + public string mandateReference; + public string mandateUrl; + private DateTime mandateSignatureDateField; + private bool mandateSignatureDateSet; + public DateTime mandateSignatureDate + { + get + { + return mandateSignatureDateField; + } + set + { + mandateSignatureDateField = value; + mandateSignatureDateSet = true; + } + } + + + public string iban; + private countryTypeEnum preferredLanguageCodeField; + private bool preferredLanguageCodeSet; + public countryTypeEnum preferredLanguage + { + get { return preferredLanguageCodeField; } + set { preferredLanguageCodeField = value; preferredLanguageCodeSet = true; } + } + public string Serialize() + { + string xml = ""; + if (mandateProvider != null) xml += "\r\n" + SecurityElement.Escape(mandateProvider) + ""; + if (sequenceTypeCodeSet) xml += "\r\n" + sequenceTypeCodeField + ""; + if (mandateReference != null) xml += "\r\n" + SecurityElement.Escape(mandateReference) + ""; + if (mandateUrl != null) xml += "\r\n" + SecurityElement.Escape(mandateUrl) + ""; + if (mandateSignatureDateSet) xml += "\r\n" + XmlUtil.toXsdDate(mandateSignatureDateField) + ""; + if (iban != null) xml += "\r\n" + SecurityElement.Escape(iban) + ""; + if (preferredLanguageCodeSet) xml += "\r\n" + preferredLanguageCodeField + ""; + return xml; + } + } + + public enum sequenceType + { + OneTime, + FirstRecurring, + SubsequentRecurring, + FinalRecurring + } + + public partial class idealType + { + private countryTypeEnum preferredLanguageCodeField; + private bool preferredLanguageCodeSet; + public countryTypeEnum preferredLanguage + { + get { return preferredLanguageCodeField; } + set { preferredLanguageCodeField = value; preferredLanguageCodeSet = true; } + } + public string Serialize() + { + string xml = ""; + if (preferredLanguageCodeSet) xml += "\r\n" + preferredLanguageCodeField + ""; + return xml; + } + } + + + public partial class applepayHeaderType + { + public string applicationData; + public string ephemeralPublicKey; + public string publicKeyHash; + public string transactionId; + + public string Serialize() + { + string xml = ""; + if (applicationData != null) xml += "\r\n" + SecurityElement.Escape(applicationData) + ""; + if (ephemeralPublicKey != null) xml += "\r\n" + SecurityElement.Escape(ephemeralPublicKey) + ""; + if (publicKeyHash != null) xml += "\r\n" + SecurityElement.Escape(publicKeyHash) + ""; + if (transactionId != null) xml += "\r\n" + SecurityElement.Escape(transactionId) + ""; + return xml; + } + } + + public class wallet + { + public walletWalletSourceType walletSourceType; + public string walletSourceTypeId; + + public string Serialize() + { + var xml = "\r\n" + walletSourceType + ""; + if (walletSourceTypeId != null) xml += "\r\n" + SecurityElement.Escape(walletSourceTypeId) + ""; + return xml; + } + } + + public enum walletWalletSourceType + { + MasterPass, + VisaCheckout + } + + public enum processingType + { + accountFunding, + initialRecurring, + initialInstallment + } + + public partial class fraudCheck : transactionTypeWithReportGroup + { + + public advancedFraudChecksType advancedFraudChecks; + + private contact billToAddressField; + private bool billToAddressSet; + public contact billToAddress + { + get + { + return billToAddressField; + } + set + { + billToAddressField = value; billToAddressSet = true; + } + } + + private contact shipToAddressField; + private bool shipToAddressSet; + public contact shipToAddress + { + get + { + return shipToAddressField; + } + set + { + shipToAddressField = value; shipToAddressSet = true; + } + } + + private int amountField; + private bool amountSet; + public int amount + { + get + { + return amountField; + } + set + { + amountField = value; amountSet = true; + } + } + + public override string Serialize() + { + string xml = "\r\n"; + if (advancedFraudChecks != null) xml += "\r\n" + advancedFraudChecks.Serialize() + "\r\n"; + if (billToAddressSet) xml += "\r\n" + billToAddressField.Serialize() + ""; + if (shipToAddressSet) xml += "\r\n" + shipToAddressField.Serialize() + ""; + if (amountSet) xml += "\r\n" + amountField.ToString() + ""; + xml += "\r\n"; + return xml; + } + } +} diff --git a/LitleSdkForNet/LitleSdkForNet/XmlResponseFields.cs b/LitleSdkForNet/LitleSdkForNet/XmlResponseFields.cs index edc75235..d130e903 100644 --- a/LitleSdkForNet/LitleSdkForNet/XmlResponseFields.cs +++ b/LitleSdkForNet/LitleSdkForNet/XmlResponseFields.cs @@ -552,6 +552,22 @@ public partial class advancedFraudResultsType public string triggeredRule; } + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.litle.com/schema")] + [System.Xml.Serialization.XmlRootAttribute(Namespace = "http://www.litle.com/schema", IsNullable = false)] + public partial class cardSuffixType + { + private string cardSuffixField; + + public string cardSuffix + { + get { return cardSuffixField; } + set { cardSuffixField = value; } + } + } + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")] [System.SerializableAttribute()] @@ -1654,6 +1670,8 @@ public partial class registerTokenResponse : transactionTypeWithReportGroup private applepayResponse applepayResponseField; + private androidpayResponse androidpayResponseField; + /// public long litleTxnId { @@ -1797,6 +1815,12 @@ public applepayResponse applepayResponse this.applepayResponseField = value; } } + + public androidpayResponse androidpayResponse + { + get { return androidpayResponseField; } + set { androidpayResponseField = value; } + } } /// @@ -1937,6 +1961,12 @@ public partial class authorizationResponse : transactionTypeWithReportGroup private applepayResponse applepayResponseField; + private string cardSuffixField; + + private androidpayResponse androidpayResponseField; + + private string networkTransactionIdField; + /// public long litleTxnId { @@ -2212,6 +2242,24 @@ public applepayResponse applepayResponse this.applepayResponseField = value; } } + + public string cardSuffix + { + get { return cardSuffixField; } + set { cardSuffixField = value; } + } + + public androidpayResponse androidpayResponse + { + get { return androidpayResponseField; } + set { androidpayResponseField = value; } + } + + public string networkTransactionId + { + get { return networkTransactionIdField; } + set { networkTransactionIdField = value; } + } } /// @@ -3365,6 +3413,16 @@ public partial class saleResponse : transactionTypeWithReportGroup private bool duplicateFieldSpecified; + private string cardSuffixField; + + private androidpayResponse androidpayResponseField; + + private string networkTransactionIdField; + + private sepaDirectDebitResponse sepaDirectDebitResponseField; + + private idealResponse idealResponseField; + /// public long litleTxnId { @@ -3668,6 +3726,132 @@ public bool duplicateSpecified this.duplicateFieldSpecified = value; } } + + public string cardSuffix + { + get { return cardSuffixField; } + set { cardSuffixField = value; } + } + + public androidpayResponse androidpayResponse + { + get { return androidpayResponseField; } + set { androidpayResponseField = value; } + } + + public string networkTransactionId + { + get { return networkTransactionIdField; } + set { networkTransactionIdField = value; } + } + + /// + public sepaDirectDebitResponse sepaDirectDebitResponse + { + get + { + return this.sepaDirectDebitResponseField; + } + set + { + this.sepaDirectDebitResponseField = value; + } + } + + /// + public idealResponse idealResponse + { + get + { + return this.idealResponseField; + } + set + { + this.idealResponseField = value; + } + } + } + + public partial class sepaDirectDebitResponse + { + private string redirectUrlField; + private string redirectTokenField; + private string mandateReferenceField; + + public string redirectUrl + { + get + { + return this.redirectUrlField; + } + set + { + this.redirectUrlField = value; + } + } + public string redirectToken + { + get + { + return this.redirectTokenField; + } + set + { + this.redirectTokenField = value; + } + } + public string mandateReference + { + get + { + return this.mandateReferenceField; + } + set + { + this.mandateReferenceField = value; + } + } + } + + public partial class idealResponse + { + private string redirectUrlField; + private string redirectTokenField; + private string paymentPurposeField; + + public string redirectUrl + { + get + { + return this.redirectUrlField; + } + set + { + this.redirectUrlField = value; + } + } + public string redirectToken + { + get + { + return this.redirectTokenField; + } + set + { + this.redirectTokenField = value; + } + } + public string paymentPurpose + { + get + { + return this.paymentPurposeField; + } + set + { + this.paymentPurposeField = value; + } + } } /// @@ -4523,6 +4707,7 @@ public partial class litleOnlineResponse public deactivateReversalResponse deactivateReversalResponse; public loadReversalResponse loadReversalResponse; public unloadReversalResponse unloadReversalResponse; + public fraudCheckResponse fraudCheckResponse; /// [System.Xml.Serialization.XmlAttributeAttribute()] @@ -6104,10 +6289,10 @@ public voidRecyclingResponseType recycling [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.litle.com/schema")] public partial class giftCardResponse { - public String availableBalance; - public String beginningBalance; - public String endingBalance; - public String cashBackAmount; + public string availableBalance; + public string beginningBalance; + public string endingBalance; + public string cashBackAmount; } /// @@ -6117,8 +6302,9 @@ public partial class giftCardResponse [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.litle.com/schema")] public partial class virtualGiftCardResponseType { - public String accountNumber; - public String cardValidationNum; + public string accountNumber; + public string cardValidationNum; + public string pin; } /// @@ -6496,6 +6682,75 @@ public string eciIndicator } } + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.litle.com/schema")] + [System.Xml.Serialization.XmlRootAttribute(Namespace = "http://www.litle.com/schema", IsNullable = false)] + public partial class androidpayResponse + { + + private string expMonthField; + + private string expYearField; + + private byte[] cryptogramField; + + private string eciIndicatorField; + /// + public string expYear + { + get + { + return expYearField; + } + set + { + expYearField = value; + } + } + + /// + public string expMonth + { + get + { + return expMonthField; + } + set + { + expMonthField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(DataType = "base64Binary")] + public byte[] cryptogram + { + get + { + return cryptogramField; + } + set + { + cryptogramField = value; + } + } + + /// + public string eciIndicator + { + get + { + return this.eciIndicatorField; + } + set + { + this.eciIndicatorField = value; + } + } + } + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")] [System.SerializableAttribute()] diff --git a/LitleSdkForNet/LitleSdkForNet/app.config b/LitleSdkForNet/LitleSdkForNet/app.config index 9595e3c9..4a62f51f 100644 --- a/LitleSdkForNet/LitleSdkForNet/app.config +++ b/LitleSdkForNet/LitleSdkForNet/app.config @@ -48,7 +48,7 @@ true - https://www.testlitle.com/sandbox/communicator/online + https://prelive.litle.com/vap/communicator/online @@ -68,8 +68,7 @@ - - http://sdkdev-vm1:8081/sandbox/communicator/online + https://www.testlitle.com/sandbox/communicator/online Default Report Group diff --git a/LitleSdkForNet/LitleSdkForNet/dotNetSDKKey.snk b/LitleSdkForNet/LitleSdkForNet/dotNetSDKKey.snk new file mode 100644 index 00000000..7abcdb37 Binary files /dev/null and b/LitleSdkForNet/LitleSdkForNet/dotNetSDKKey.snk differ diff --git a/LitleSdkForNet/LitleSdkForNet/knownhosts b/LitleSdkForNet/LitleSdkForNet/knownhosts index 5d4b8fe5..db79e447 100644 --- a/LitleSdkForNet/LitleSdkForNet/knownhosts +++ b/LitleSdkForNet/LitleSdkForNet/knownhosts @@ -1,4 +1 @@ -# cert.litle.com SSH-2.0-OpenSSH_5.3 -cert.litle.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAsmt+swxC5/rbnRA6evRvXrv5zArkloqlAPgmSXqXNQHbokNGQE8xJgdtFwb5akz5u8CC02jtfgUtfsxWsmtZwnt+UKa2KGlMuorkru+s0zEEYt2NSMjU/CzgSJsi5mdQdqU30zDWmS3SnC6P63wyheXBRNT/w0LLZ0mI4USgfEs= -# cert.litle.com SSH-2.0-OpenSSH_5.3 -cert.litle.com ssh-dss AAAAB3NzaC1kc3MAAACBALsj3P3J/g5O9lgzUbdj4LXdoHSbUwjNzkgxRimpzLx0PmKj6DllmbyLEUdO5fQ5BhAOdC9JqxJkiBs4H8m7Izg6+SRH7BQIFTEUOIr6n+GYBu91IlRW94Nyaps8uIfZAky03EUUukiD9sIP8uX7Ok1gDqIdZ8i8uyW6oNsTxK3XAAAAFQDuI8yJFbkIbFcAb78MadQkMD8gDQAAAIBbUAWlESzJRkc+azg1FDym1dSgI1YQ+hri644RP2dW0P4ySdQzN+aoHVOl/lqTZQs4O8GpjIHX4AC5ab2zGK39XC0uxj9h3BLfsJYyg6z9NBH1Kp0U8XBxa6Mt5yiMi1SOalKKhuoBu2qpqSCYYI32hrev+vIGNcvmFEflTqEMPwAAAIALuC6pALzmaKDL7BpDE0UJFlhY0JcV1Xo0tZELIY2E1JTSPL9mwQ4nA98nyjc+4IcTrLuUpz2J7eiqdRxLPtJr2rurOtXpwSGsIQMX2vPYYDq1vrz5ObuwhPfGqKyOShlKsbNcEfp1X+pIiFRP+hianVOzpwgyZEQ2KBYicJhY2g== +prelive.litle.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAsmt+swxC5/rbnRA6evRvXrv5zArkloqlAPgmSXqXNQHbokNGQE8xJgdtFwb5akz5u8CC02jtfgUtfsxWsmtZwnt+UKa2KGlMuorkru+s0zEEYt2NSMjU/CzgSJsi5mdQdqU30zDWmS3SnC6P63wyheXBRNT/w0LLZ0mI4USgfEs= \ No newline at end of file diff --git a/LitleSdkForNet/LitleSdkForNet/lib/DiffieHellman.dll b/LitleSdkForNet/LitleSdkForNet/lib/DiffieHellman.dll index aa310511..bc52de88 100644 Binary files a/LitleSdkForNet/LitleSdkForNet/lib/DiffieHellman.dll and b/LitleSdkForNet/LitleSdkForNet/lib/DiffieHellman.dll differ diff --git a/LitleSdkForNet/LitleSdkForNet/lib/Org.Mentalis.Security.dll b/LitleSdkForNet/LitleSdkForNet/lib/Org.Mentalis.Security.dll deleted file mode 100644 index bac39dd9..00000000 Binary files a/LitleSdkForNet/LitleSdkForNet/lib/Org.Mentalis.Security.dll and /dev/null differ diff --git a/LitleSdkForNet/LitleSdkForNet/lib/Tamir.SharpSSH.dll b/LitleSdkForNet/LitleSdkForNet/lib/Tamir.SharpSSH.dll index 31ef3354..584a6398 100644 Binary files a/LitleSdkForNet/LitleSdkForNet/lib/Tamir.SharpSSH.dll and b/LitleSdkForNet/LitleSdkForNet/lib/Tamir.SharpSSH.dll differ diff --git a/LitleSdkForNet/LitleSdkForNetTest/Certification/TestCert1Base.cs b/LitleSdkForNet/LitleSdkForNetTest/Certification/TestCert1Base.cs index 8f62a1b6..19278361 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Certification/TestCert1Base.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Certification/TestCert1Base.cs @@ -19,7 +19,7 @@ public void setUp() config.Add("reportGroup", "Default Report Group"); config.Add("username", "DOTNET"); config.Add("version", "9.00"); - config.Add("timeout", "65"); + config.Add("timeout", Properties.Settings.Default.timeout); config.Add("merchantId", "101"); config.Add("password", "TESTCASE"); config.Add("printxml", "true"); diff --git a/LitleSdkForNet/LitleSdkForNetTest/Certification/TestCert2AuthEnhanced.cs b/LitleSdkForNet/LitleSdkForNetTest/Certification/TestCert2AuthEnhanced.cs index 82229665..cb98be01 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Certification/TestCert2AuthEnhanced.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Certification/TestCert2AuthEnhanced.cs @@ -20,7 +20,7 @@ public void setUp() config.Add("reportGroup", "Default Report Group"); config.Add("username", "DOTNET"); config.Add("version", "8.13"); - config.Add("timeout", "65"); + config.Add("timeout", "5000"); config.Add("merchantId", "101"); config.Add("password", "TESTCASE"); config.Add("printxml", "true"); @@ -305,7 +305,6 @@ public void test26() authorizationResponse response = litle.Authorize(authorization); Assert.AreEqual("341", response.response); - Assert.AreEqual("Invalid healthcare amounts", response.message); } [Test] @@ -331,7 +330,6 @@ public void test27() authorizationResponse response = litle.Authorize(authorization); Assert.AreEqual("341", response.response); - Assert.AreEqual("Invalid healthcare amounts", response.message); } [Test] @@ -386,7 +384,6 @@ public void test29() authorizationResponse response = litle.Authorize(authorization); Assert.AreEqual("341", response.response); - Assert.AreEqual("Invalid healthcare amounts", response.message); } [Test] @@ -415,7 +412,6 @@ public void test30() authorizationResponse response = litle.Authorize(authorization); Assert.AreEqual("341", response.response); - Assert.AreEqual("Invalid healthcare amounts", response.message); } [Test] diff --git a/LitleSdkForNet/LitleSdkForNetTest/Certification/TestCert3AuthReversal.cs b/LitleSdkForNet/LitleSdkForNetTest/Certification/TestCert3AuthReversal.cs index d28ce52e..be4a1572 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Certification/TestCert3AuthReversal.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Certification/TestCert3AuthReversal.cs @@ -19,7 +19,7 @@ public void setUp() config.Add("reportGroup", "Default Report Group"); config.Add("username", "DOTNET"); config.Add("version", "8.13"); - config.Add("timeout", "65"); + config.Add("timeout", "5000"); config.Add("merchantId", "101"); config.Add("password", "TESTCASE"); config.Add("printxml", "true"); diff --git a/LitleSdkForNet/LitleSdkForNetTest/Certification/TestCert4Echeck.cs b/LitleSdkForNet/LitleSdkForNetTest/Certification/TestCert4Echeck.cs index 1b3651eb..206de50a 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Certification/TestCert4Echeck.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Certification/TestCert4Echeck.cs @@ -19,7 +19,7 @@ public void setUp() config.Add("reportGroup", "Default Report Group"); config.Add("username", "DOTNET"); config.Add("version", "8.13"); - config.Add("timeout", "65"); + config.Add("timeout", "5000"); config.Add("merchantId", "101"); config.Add("password", "TESTCASE"); config.Add("printxml", "true"); diff --git a/LitleSdkForNet/LitleSdkForNetTest/Certification/TestCert5Token.cs b/LitleSdkForNet/LitleSdkForNetTest/Certification/TestCert5Token.cs index 6b81563b..ac329ac1 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Certification/TestCert5Token.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Certification/TestCert5Token.cs @@ -19,7 +19,7 @@ public void setUp() config.Add("reportGroup", "Default Report Group"); config.Add("username", "DOTNET"); config.Add("version", "8.13"); - config.Add("timeout", "65"); + config.Add("timeout", "5000"); config.Add("merchantId", "101"); config.Add("password", "TESTCASE"); config.Add("printxml", "true"); @@ -102,7 +102,6 @@ public void test54() registerTokenResponse response = litle.RegisterToken(request); Assert.AreEqual("900", response.response); - Assert.AreEqual("Invalid bank routing number", response.message); } [Test] @@ -144,7 +143,6 @@ public void test56() authorizationResponse response = litle.Authorize(auth); Assert.AreEqual("301", response.response); - Assert.AreEqual("Invalid account number", response.message); } [Test] @@ -201,7 +199,6 @@ public void test60() authorizationResponse response = litle.Authorize(auth); Assert.AreEqual("823", response.response); - Assert.AreEqual("Token was invalid", response.message); } [Test] diff --git a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestAuth.cs b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestAuth.cs index cd0da742..15f256ad 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestAuth.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestAuth.cs @@ -1,176 +1,347 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; using NUnit.Framework; -using Litle.Sdk; namespace Litle.Sdk.Test.Functional { [TestFixture] - class TestAuth + internal class TestAuth { - private LitleOnline litle; - private Dictionary config; + private LitleOnline _litle; + private Dictionary _config; [TestFixtureSetUp] public void SetUpLitle() { - config = new Dictionary(); - config.Add("url", "https://www.testlitle.com/sandbox/communicator/online"); - config.Add("reportGroup", "Default Report Group"); - config.Add("username", "DOTNET"); - config.Add("version", "8.13"); - config.Add("timeout", "65"); - config.Add("merchantId", "101"); - config.Add("password", "TESTCASE"); - config.Add("printxml", "true"); - config.Add("proxyHost", Properties.Settings.Default.proxyHost); - config.Add("proxyPort", Properties.Settings.Default.proxyPort); - config.Add("logFile", Properties.Settings.Default.logFile); - config.Add("neuterAccountNums", "true"); - litle = new LitleOnline(config); + _config = new Dictionary + { + {"url", "https://www.testlitle.com/sandbox/communicator/online"}, + {"reportGroup", "Default Report Group"}, + {"username", "DOTNET"}, + {"version", "9.12"}, + {"timeout", "5000"}, + {"merchantId", "101"}, + {"password", "TESTCASE"}, + {"printxml", "true"}, + {"proxyHost", Properties.Settings.Default.proxyHost}, + {"proxyPort", Properties.Settings.Default.proxyPort}, + {"logFile", Properties.Settings.Default.logFile}, + {"neuterAccountNums", "true"} + }; + + _litle = new LitleOnline(_config); } [Test] public void SimpleAuthWithCard() { - authorization authorization = new authorization(); - authorization.reportGroup = "Planets"; - authorization.orderId = "12344"; - authorization.amount = 106; - authorization.orderSource = orderSourceType.ecommerce; - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.VI; - card.number = "414100000000000000"; - card.expDate = "1210"; - authorization.card = card; //This needs to compile - - customBilling cb = new customBilling(); - cb.phone = "1112223333"; //This needs to compile too - - authorizationResponse response = litle.Authorize(authorization); + var authorization = new authorization + { + reportGroup = "Planets", + orderId = "1", + amount = 106, + orderSource = orderSourceType.ecommerce, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "414100000000000000", + expDate = "1210" + }, + customBilling = new customBilling { phone = "1112223333" } + }; + + var response = _litle.Authorize(authorization); + Assert.AreEqual("000", response.response); + } + + [Test] + public void SimpleAuthWithMasterCard() + { + var authorization = new authorization + { + reportGroup = "Planets", + orderId = "2", + amount = 106, + orderSource = orderSourceType.ecommerce, + card = new cardType + { + type = methodOfPaymentTypeEnum.MC, + number = "540000000000000000", + expDate = "1210" + }, + customBilling = new customBilling { phone = "1112223333" } + }; + + var response = _litle.Authorize(authorization); Assert.AreEqual("000", response.response); + Assert.Null(response.networkTransactionId); } + + [Test] + public void SimpleAuthWithCard_CardSuffixResponse() + { + var authorization = new authorization + { + reportGroup = "Planets", + orderId = "3", + amount = 106, + orderSource = orderSourceType.ecommerce, + processingType = processingType.accountFunding, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "410070000000000000", + expDate = "1210" + }, + customBilling = new customBilling { phone = "1112223333" } + }; + + var response = _litle.Authorize(authorization); + Assert.AreEqual("000", response.response); + Assert.AreEqual("123456", response.cardSuffix); + } + + [Test] + public void SimpleAuthWithCard_networkTxnId() + { + var authorization = new authorization + { + reportGroup = "Planets", + orderId = "4", + amount = 106, + orderSource = orderSourceType.ecommerce, + processingType = processingType.initialInstallment, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "410080000000000000", + expDate = "1210" + }, + customBilling = new customBilling { phone = "1112223333" } + }; + + var response = _litle.Authorize(authorization); + Assert.AreEqual("000", response.response); + Assert.AreEqual("63225578415568556365452427825", response.networkTransactionId); + } + + [Test] + public void SimpleAuthWithCard_origTxnIdAndAmount() + { + var authorization = new authorization + { + reportGroup = "Planets", + orderId = "5", + amount = 106, + orderSource = orderSourceType.ecommerce, + originalNetworkTransactionId = "123456789012345678901234567890", + originalTransactionAmount = 2500, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "410000000000000000", + expDate = "1210" + }, + customBilling = new customBilling { phone = "1112223333" } + }; + + var response = _litle.Authorize(authorization); + Assert.AreEqual("000", response.response); + } + [Test] public void SimpleAuthWithMpos() { - authorization authorization = new authorization(); - authorization.reportGroup = "Planets"; - authorization.orderId = "12344"; - authorization.amount = 200; - authorization.orderSource = orderSourceType.ecommerce; - mposType mpos = new mposType(); - mpos.ksn = "77853211300008E00016"; - mpos.encryptedTrack = "CASE1E185EADD6AFE78C9A214B21313DCD836FDD555FBE3A6C48D141FE80AB9172B963265AFF72111895FE415DEDA162CE8CB7AC4D91EDB611A2AB756AA9CB1A000000000000000000000000000000005A7AAF5E8885A9DB88ECD2430C497003F2646619A2382FFF205767492306AC804E8E64E8EA6981DD"; - mpos.formatId = "30"; - mpos.track1Status = 0; - mpos.track2Status = 0; - authorization.mpos = mpos; //This needs to compile - - - authorizationResponse response = litle.Authorize(authorization); + var authorization = new authorization + { + reportGroup = "Planets", + orderId = "6", + amount = 200, + orderSource = orderSourceType.ecommerce, + mpos = new mposType + { + ksn = "77853211300008E00016", + encryptedTrack = + "CASE1E185EADD6AFE78C9A214B21313DCD836FDD555FBE3A6C48D141FE80AB9172B963265AFF72111895FE415DEDA162CE8CB7AC4D91EDB611A2AB756AA9CB1A000000000000000000000000000000005A7AAF5E8885A9DB88ECD2430C497003F2646619A2382FFF205767492306AC804E8E64E8EA6981DD", + formatId = "30", + track1Status = 0, + track2Status = 0 + } + }; + + var response = _litle.Authorize(authorization); Assert.AreEqual("000", response.response); } - [Test] + + [Test] public void AuthWithAmpersand() { - authorization authorization = new authorization(); - authorization.orderId = "1"; - authorization.amount = 10010; - authorization.orderSource = orderSourceType.ecommerce; - contact contact = new contact(); - contact.name = "John & Jane Smith"; - contact.addressLine1 = "1 Main St."; - contact.city = "Burlington"; - contact.state = "MA"; - contact.zip = "01803-3747"; - contact.country = countryTypeEnum.US; - authorization.billToAddress = contact; - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.VI; - card.number = "4457010000000009"; - card.expDate = "0112"; - card.cardValidationNum = "349"; - authorization.card = card; - authorizationResponse response = litle.Authorize(authorization); + var authorization = new authorization + { + orderId = "7", + amount = 10010, + orderSource = orderSourceType.ecommerce, + billToAddress = new contact + { + name = "John & Jane Smith", + addressLine1 = "1 Main St.", + city = "Burlington", + state = "MA", + zip = "01803-3747", + country = countryTypeEnum.US + }, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4457010000000009", + expDate = "0112", + cardValidationNum = "349" + } + }; + + var response = _litle.Authorize(authorization); Assert.AreEqual("000", response.response); - } + } + [Test] - public void simpleAuthWithPaypal() + public void SimpleAuthWithPaypal() { - authorization authorization = new authorization(); - authorization.reportGroup = "Planets"; - authorization.orderId = "123456"; - authorization.amount = 106; - authorization.orderSource = orderSourceType.ecommerce; - payPal paypal = new payPal(); - paypal.payerId = "1234"; - paypal.token = "1234"; - paypal.transactionId = "123456"; - authorization.paypal = paypal; //This needs to compile - - customBilling cb = new customBilling(); - cb.phone = "1112223333"; //This needs to compile too - - authorizationResponse response = litle.Authorize(authorization); + var authorization = new authorization + { + reportGroup = "Planets", + orderId = "8", + amount = 106, + orderSource = orderSourceType.ecommerce, + paypal = new payPal + { + payerId = "1234", + token = "1234", + transactionId = "123456" + }, + customBilling = new customBilling { phone = "1112223333" } + }; + + var response = _litle.Authorize(authorization); Assert.AreEqual("Approved", response.message); } [Test] - public void simpleAuthWithApplepayAndSecondaryAmountAndWallet() + public void SimpleAuthWithAndroidPay() { - authorization authorization = new authorization(); - authorization.reportGroup = "Planets"; - authorization.orderId = "123456"; - authorization.amount = 110; - authorization.secondaryAmount = 50; - authorization.orderSource = orderSourceType.applepay; - applepayType applepay = new applepayType(); - applepayHeaderType applepayHeaderType = new applepayHeaderType(); - applepayHeaderType.applicationData = "454657413164"; - applepayHeaderType.ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; - applepayHeaderType.publicKeyHash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; - applepayHeaderType.transactionId = "1234"; - applepay.header = applepayHeaderType; - applepay.data = "user"; - applepay.signature = "sign"; - applepay.version = "1"; - authorization.applepay = applepay; - - wallet wallet = new wallet(); - wallet.walletSourceTypeId = "123"; - wallet.walletSourceType = walletWalletSourceType.MasterPass; - authorization.wallet = wallet; - - authorizationResponse response = litle.Authorize(authorization); + var authorization = new authorization + { + reportGroup = "Planets", + orderId = "9", + amount = 106, + orderSource = orderSourceType.androidpay, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "414100000000000000", + expDate = "1210" + }, + customBilling = new customBilling { phone = "1112223333" } + }; + + var response = _litle.Authorize(authorization); + Assert.AreEqual("Approved", response.message); + Assert.AreEqual("01", response.androidpayResponse.expMonth); + Assert.AreEqual("2050", response.androidpayResponse.expYear); + Assert.IsNotEmpty(response.androidpayResponse.cryptogram); + } + + [Test] + public void simpleAuthWithApplepayAndSecondaryAmountAndWallet_MasterPass() + { + var authorization = new authorization + { + reportGroup = "Planets", + orderId = "10", + amount = 110, + secondaryAmount = 50, + orderSource = orderSourceType.applepay, + applepay = new applepayType + { + data = "user", + signature = "sign", + version = "12345", + header = new applepayHeaderType + { + applicationData = "454657413164", + ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + publicKeyHash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + transactionId = "1234" + } + }, + wallet = new wallet + { + walletSourceTypeId = "123", + walletSourceType = walletWalletSourceType.MasterPass + } + }; + + var response = _litle.Authorize(authorization); Assert.AreEqual("Insufficient Funds", response.message); Assert.AreEqual("110", response.applepayResponse.transactionAmount); } [Test] - public void posWithoutCapabilityAndEntryMode() + public void simpleAuthWithApplepayAndSecondaryAmountAndWallet_VisaCheckout() { - authorization authorization = new authorization(); - authorization.reportGroup = "Planets"; - authorization.orderId = "12344"; - authorization.amount = 106; - authorization.orderSource = orderSourceType.ecommerce; - pos pos = new pos(); - pos.cardholderId = posCardholderIdTypeEnum.pin; - authorization.pos = pos; - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.VI; - card.number = "4100000000000002"; - card.expDate = "1210"; - authorization.card = card; //This needs to compile - - customBilling cb = new customBilling(); - cb.phone = "1112223333"; //This needs to compile too + var authorization = new authorization + { + reportGroup = "Planets", + orderId = "11", + amount = 110, + secondaryAmount = 50, + orderSource = orderSourceType.applepay, + applepay = new applepayType + { + data = "user", + signature = "sign", + version = "12345", + header = new applepayHeaderType + { + applicationData = "454657413164", + ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + publicKeyHash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + transactionId = "1234" + } + }, + wallet = new wallet + { + walletSourceTypeId = "123", + walletSourceType = walletWalletSourceType.VisaCheckout + } + }; + + var response = _litle.Authorize(authorization); + Assert.AreEqual("Insufficient Funds", response.message); + Assert.AreEqual("110", response.applepayResponse.transactionAmount); + } + [Test] + public void PosWithoutCapabilityAndEntryMode() + { + var authorization = new authorization + { + reportGroup = "Planets", + orderId = "12", + amount = 106, + orderSource = orderSourceType.ecommerce, + pos = new pos { cardholderId = posCardholderIdTypeEnum.pin }, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000002", + expDate = "1210" + }, + customBilling = new customBilling { phone = "1112223333" } + }; + try { - litle.Authorize(authorization); - //expected exception; + _litle.Authorize(authorization); + Assert.Fail("Exception is expected!"); } catch (LitleOnlineException e) { @@ -179,136 +350,178 @@ public void posWithoutCapabilityAndEntryMode() } [Test] - public void trackData() + public void TrackData() { - authorization authorization = new authorization(); - authorization.id = "AX54321678"; - authorization.reportGroup = "RG27"; - authorization.orderId = "12z58743y1"; - authorization.amount = 12522L; - authorization.orderSource = orderSourceType.retail; - contact billToAddress = new contact(); - billToAddress.zip = "95032"; - authorization.billToAddress = billToAddress; - cardType card = new cardType(); - card.track = "%B40000001^Doe/JohnP^06041...?;40001=0604101064200?"; - authorization.card = card; - pos pos = new pos(); - pos.capability = posCapabilityTypeEnum.magstripe; - pos.entryMode = posEntryModeTypeEnum.completeread; - pos.cardholderId = posCardholderIdTypeEnum.signature; - authorization.pos = pos; - - authorizationResponse response = litle.Authorize(authorization); + var authorization = new authorization + { + id = "AX54321678", + reportGroup = "RG27", + orderId = "13", + amount = 12522L, + orderSource = orderSourceType.retail, + billToAddress = new contact { zip = "95032" }, + card = new cardType { track = "%B40000001^Doe/JohnP^06041...?;40001=0604101064200?" }, + pos = new pos + { + capability = posCapabilityTypeEnum.magstripe, + entryMode = posEntryModeTypeEnum.completeread, + cardholderId = posCardholderIdTypeEnum.signature + } + }; + + var response = _litle.Authorize(authorization); Assert.AreEqual("Approved", response.message); } [Test] - public void testAuthHandleSpecialCharacters() + public void TestAuthHandleSpecialCharacters() { - authorization authorization = new authorization(); - authorization.reportGroup = "<'&\">"; - authorization.orderId = "123456"; - authorization.amount = 106; - authorization.orderSource = orderSourceType.ecommerce; - payPal paypal = new payPal(); - paypal.payerId = "1234"; - paypal.token = "1234"; - paypal.transactionId = "123456"; - authorization.paypal = paypal; //This needs to compile - - customBilling cb = new customBilling(); - cb.phone = "<'&\">"; //This needs to compile too - - authorizationResponse response = litle.Authorize(authorization); + var authorization = new authorization + { + reportGroup = "<'&\">", + orderId = "14", + amount = 106, + orderSource = orderSourceType.ecommerce, + paypal = new payPal + { + payerId = "1234", + token = "1234", + transactionId = "123456" + } + }; + + var response = _litle.Authorize(authorization); Assert.AreEqual("Approved", response.message); } [Test] public void TestNotHavingTheLogFileSettingShouldDefaultItsValueToNull() { - config.Remove("logFile"); - - authorization authorization = new authorization(); - authorization.reportGroup = "Planets"; - authorization.orderId = "12344"; - authorization.amount = 106; - authorization.orderSource = orderSourceType.ecommerce; - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.VI; - card.number = "414100000000000000"; - card.expDate = "1210"; - authorization.card = card; - - authorizationResponse response = litle.Authorize(authorization); + _config.Remove("logFile"); + + var authorization = new authorization + { + reportGroup = "Planets", + orderId = "15", + amount = 106, + orderSource = orderSourceType.ecommerce, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "414100000000000000", + expDate = "1210" + } + }; + + var response = _litle.Authorize(authorization); Assert.AreEqual("000", response.response); } [Test] public void TestNeuterAccountNumsShouldDefaultToFalse() { - config.Remove("neuterAccountNums"); - - authorization authorization = new authorization(); - authorization.reportGroup = "Planets"; - authorization.orderId = "12344"; - authorization.amount = 106; - authorization.orderSource = orderSourceType.ecommerce; - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.VI; - card.number = "414100000000000000"; - card.expDate = "1210"; - authorization.card = card; - - authorizationResponse response = litle.Authorize(authorization); + _config.Remove("neuterAccountNums"); + + var authorization = new authorization + { + reportGroup = "Planets", + orderId = "16", + amount = 106, + orderSource = orderSourceType.ecommerce, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "414100000000000000", + expDate = "1210" + } + }; + + var response = _litle.Authorize(authorization); Assert.AreEqual("000", response.response); } [Test] public void TestPrintxmlShouldDefaultToFalse() { - config.Remove("printxml"); - - authorization authorization = new authorization(); - authorization.reportGroup = "Planets"; - authorization.orderId = "12344"; - authorization.amount = 106; - authorization.orderSource = orderSourceType.ecommerce; - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.VI; - card.number = "414100000000000000"; - card.expDate = "1210"; - authorization.card = card; - - authorizationResponse response = litle.Authorize(authorization); + _config.Remove("printxml"); + + var authorization = new authorization + { + reportGroup = "Planets", + orderId = "17", + amount = 106, + orderSource = orderSourceType.ecommerce, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "414100000000000000", + expDate = "1210" + } + }; + + var response = _litle.Authorize(authorization); Assert.AreEqual("000", response.response); } [Test] public void TestWithAdvancedFraudCheck() { - config.Remove("printxml"); - - authorization authorization = new authorization(); - authorization.reportGroup = "Planets"; - authorization.orderId = "12344"; - authorization.amount = 106; - authorization.orderSource = orderSourceType.ecommerce; - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.VI; - card.number = "414100000000000000"; - card.expDate = "1210"; - authorization.card = card; - advancedFraudChecksType advancedFraudChecks = new advancedFraudChecksType(); - advancedFraudChecks.threatMetrixSessionId = "800"; - advancedFraudChecks.customAttribute1 = "testAttribute1"; - advancedFraudChecks.customAttribute2 = "testAttribute2"; - advancedFraudChecks.customAttribute3 = "testAttribute3"; - advancedFraudChecks.customAttribute4 = "testAttribute4"; - advancedFraudChecks.customAttribute5 = "testAttribute5"; - authorization.advancedFraudChecks = advancedFraudChecks; - - authorizationResponse response = litle.Authorize(authorization); + _config.Remove("printxml"); + + var authorization = new authorization + { + reportGroup = "Planets", + orderId = "18", + amount = 106, + orderSource = orderSourceType.ecommerce, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "414100000000000000", + expDate = "1210" + }, + advancedFraudChecks = new advancedFraudChecksType + { + threatMetrixSessionId = "800", + customAttribute1 = "testAttribute1", + customAttribute2 = "testAttribute2", + customAttribute3 = "testAttribute3", + customAttribute4 = "testAttribute4", + customAttribute5 = "testAttribute5" + } + }; + + var response = _litle.Authorize(authorization); + Assert.AreEqual("000", response.response); + } + + [Test] + public void TestWithFraudCheck() + { + _config.Remove("printxml"); + + var authorization = new authorization + { + reportGroup = "Planets", + orderId = "18", + amount = 106, + orderSource = orderSourceType.ecommerce, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "414100000000000000", + expDate = "1210" + }, + cardholderAuthentication = new fraudCheckType + { + authenticationValue = "aHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj1kUXc0dzlXZ1hjUQ==", + authenticationTransactionId = "11223344", + customerIpAddress = "8.8.8.8", + authenticatedByMerchant = true + } + }; + + var response = _litle.Authorize(authorization); Assert.AreEqual("000", response.response); } } diff --git a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestAuthReversal.cs b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestAuthReversal.cs index 64c75385..691555bb 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestAuthReversal.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestAuthReversal.cs @@ -1,57 +1,61 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; using NUnit.Framework; -using Litle.Sdk; + namespace Litle.Sdk.Test.Functional { [TestFixture] - class TestAuthReversal + internal class TestAuthReversal { - private LitleOnline litle; + private LitleOnline _litle; [TestFixtureSetUp] public void SetUpLitle() { - Dictionary config = new Dictionary(); - config.Add("url", "https://www.testlitle.com/sandbox/communicator/online"); - config.Add("reportGroup", "Default Report Group"); - config.Add("username", "DOTNET"); - config.Add("version", "8.13"); - config.Add("timeout", "65"); - config.Add("merchantId", "101"); - config.Add("password", "TESTCASE"); - config.Add("printxml", "true"); - config.Add("proxyHost", Properties.Settings.Default.proxyHost); - config.Add("proxyPort", Properties.Settings.Default.proxyPort); - config.Add("logFile", Properties.Settings.Default.logFile); - config.Add("neuterAccountNums", "true"); - litle = new LitleOnline(config); + var config = new Dictionary + { + {"url", "https://www.testlitle.com/sandbox/communicator/online"}, + {"reportGroup", "Default Report Group"}, + {"username", "DOTNET"}, + {"version", "8.13"}, + {"timeout", "5000"}, + {"merchantId", "101"}, + {"password", "TESTCASE"}, + {"printxml", "true"}, + {"proxyHost", Properties.Settings.Default.proxyHost}, + {"proxyPort", Properties.Settings.Default.proxyPort}, + {"logFile", Properties.Settings.Default.logFile}, + {"neuterAccountNums", "true"} + }; + _litle = new LitleOnline(config); } [Test] public void SimpleAuthReversal() { - authReversal reversal = new authReversal(); - reversal.litleTxnId = 12345678000L; - reversal.amount = 106; - reversal.payPalNotes = "Notes"; + var reversal = new authReversal + { + litleTxnId = 12345678000L, + amount = 106, + payPalNotes = "Notes" + }; - authReversalResponse response = litle.AuthReversal(reversal); + var response = _litle.AuthReversal(reversal); Assert.AreEqual("Approved", response.message); } [Test] - public void testAuthReversalHandleSpecialCharacters() + public void TestAuthReversalHandleSpecialCharacters() { - authReversal reversal = new authReversal(); - reversal.litleTxnId = 12345678000L; - reversal.amount = 106; - reversal.payPalNotes = "<'&\">"; + var reversal = new authReversal + { + litleTxnId = 12345678000L, + amount = 106, + payPalNotes = "<'&\">" + }; - authReversalResponse response = litle.AuthReversal(reversal); + var response = _litle.AuthReversal(reversal); Assert.AreEqual("Approved", response.message); - } + } } } diff --git a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestBatch.cs b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestBatch.cs index 6db61b2a..307c1f21 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestBatch.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestBatch.cs @@ -1,361 +1,439 @@ using System; using System.Collections.Generic; -using System.Text; using NUnit.Framework; -using Litle.Sdk; -using System.IO; + namespace Litle.Sdk.Test.Functional { [TestFixture] - class TestBatch + internal class TestBatch { - private litleRequest litle; - private Dictionary invalidConfig; - private Dictionary invalidSftpConfig; + private litleRequest _litle; + private Dictionary _invalidConfig; + private Dictionary _invalidSftpConfig; [TestFixtureSetUp] - public void setUp() + public void SetUp() { - invalidConfig = new Dictionary(); - invalidConfig["url"] = Properties.Settings.Default.url; - invalidConfig["reportGroup"] = Properties.Settings.Default.reportGroup; - invalidConfig["username"] = "badUsername"; - invalidConfig["printxml"] = Properties.Settings.Default.printxml; - invalidConfig["timeout"] = Properties.Settings.Default.timeout; - invalidConfig["proxyHost"] = Properties.Settings.Default.proxyHost; - invalidConfig["merchantId"] = Properties.Settings.Default.merchantId; - invalidConfig["password"] = "badPassword"; - invalidConfig["proxyPort"] = Properties.Settings.Default.proxyPort; - invalidConfig["sftpUrl"] = Properties.Settings.Default.sftpUrl; - invalidConfig["sftpUsername"] = Properties.Settings.Default.sftpUsername; - invalidConfig["sftpPassword"] = Properties.Settings.Default.sftpPassword; - invalidConfig["knownHostsFile"] = Properties.Settings.Default.knownHostsFile; - invalidConfig["requestDirectory"] = Properties.Settings.Default.requestDirectory; - invalidConfig["responseDirectory"] = Properties.Settings.Default.responseDirectory; - - - invalidSftpConfig = new Dictionary(); - invalidSftpConfig["url"] = Properties.Settings.Default.url; - invalidSftpConfig["reportGroup"] = Properties.Settings.Default.reportGroup; - invalidSftpConfig["username"] = Properties.Settings.Default.username; - invalidSftpConfig["printxml"] = Properties.Settings.Default.printxml; - invalidSftpConfig["timeout"] = Properties.Settings.Default.timeout; - invalidSftpConfig["proxyHost"] = Properties.Settings.Default.proxyHost; - invalidSftpConfig["merchantId"] = Properties.Settings.Default.merchantId; - invalidSftpConfig["password"] = Properties.Settings.Default.password; - invalidSftpConfig["proxyPort"] = Properties.Settings.Default.proxyPort; - invalidSftpConfig["sftpUrl"] = Properties.Settings.Default.sftpUrl; - invalidSftpConfig["sftpUsername"] = "badSftpUsername"; - invalidSftpConfig["sftpPassword"] = "badSftpPassword"; - invalidSftpConfig["knownHostsFile"] = Properties.Settings.Default.knownHostsFile; - invalidSftpConfig["requestDirectory"] = Properties.Settings.Default.requestDirectory; - invalidSftpConfig["responseDirectory"] = Properties.Settings.Default.responseDirectory; - + _invalidConfig = new Dictionary + { + {"url", Properties.Settings.Default.url}, + {"reportGroup", Properties.Settings.Default.reportGroup}, + {"username", "badUsername"}, + {"printxml", Properties.Settings.Default.printxml}, + {"timeout", Properties.Settings.Default.timeout}, + {"proxyHost", Properties.Settings.Default.proxyHost}, + {"merchantId", Properties.Settings.Default.merchantId}, + {"password", "badPassword"}, + {"proxyPort", Properties.Settings.Default.proxyPort}, + {"sftpUrl", Properties.Settings.Default.sftpUrl}, + {"sftpUsername", Properties.Settings.Default.sftpUsername}, + {"sftpPassword", Properties.Settings.Default.sftpPassword}, + {"knownHostsFile", Properties.Settings.Default.knownHostsFile}, + {"requestDirectory", Properties.Settings.Default.requestDirectory}, + {"responseDirectory", Properties.Settings.Default.responseDirectory} + }; + + _invalidSftpConfig = new Dictionary + { + {"url", Properties.Settings.Default.url}, + {"reportGroup", Properties.Settings.Default.reportGroup}, + {"username", Properties.Settings.Default.username}, + {"printxml", Properties.Settings.Default.printxml}, + {"timeout", Properties.Settings.Default.timeout}, + {"proxyHost", Properties.Settings.Default.proxyHost}, + {"merchantId", Properties.Settings.Default.merchantId}, + {"password", Properties.Settings.Default.password}, + {"proxyPort", Properties.Settings.Default.proxyPort}, + {"sftpUrl", Properties.Settings.Default.sftpUrl}, + {"sftpUsername", "badSftpUsername"}, + {"sftpPassword", "badSftpPassword"}, + {"knownHostsFile", Properties.Settings.Default.knownHostsFile}, + {"requestDirectory", Properties.Settings.Default.requestDirectory}, + {"responseDirectory", Properties.Settings.Default.responseDirectory} + }; + } [SetUp] - public void setUpBeforeTest() + public void SetUpBeforeTest() { - litle = new litleRequest(); + _litle = new litleRequest(); } [Test] public void SimpleBatch() { - batchRequest litleBatchRequest = new batchRequest(); - - authorization authorization = new authorization(); - authorization.reportGroup = "Planets"; - authorization.orderId = "12344"; - authorization.amount = 106; - authorization.orderSource = orderSourceType.ecommerce; - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.VI; - card.number = "4100000000000001"; - card.expDate = "1210"; - authorization.card = card; + var litleBatchRequest = new batchRequest(); + var card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000001", + expDate = "1210" + }; - litleBatchRequest.addAuthorization(authorization); + var card2 = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4242424242424242", + expDate = "1210" + }; + + var authorization = new authorization + { + reportGroup = "Planets", + orderId = "12344", + amount = 106, + orderSource = orderSourceType.ecommerce, + card = card + }; - authorization authorization2 = new authorization(); - authorization2.reportGroup = "Planets"; - authorization2.orderId = "12345"; - authorization2.amount = 106; - authorization2.orderSource = orderSourceType.ecommerce; - cardType card2 = new cardType(); - card2.type = methodOfPaymentTypeEnum.VI; - card2.number = "4242424242424242"; - card2.expDate = "1210"; - authorization2.card = card2; + litleBatchRequest.addAuthorization(authorization); - litleBatchRequest.addAuthorization(authorization2); + var authorization2 = new authorization + { + reportGroup = "Planets", + orderId = "12345", + amount = 106, + orderSource = orderSourceType.ecommerce, + card = card2 + }; - authReversal reversal = new authReversal(); - reversal.litleTxnId = 12345678000L; - reversal.amount = 106; - reversal.payPalNotes = "Notes"; + litleBatchRequest.addAuthorization(authorization2); + + var reversal = new authReversal + { + litleTxnId = 12345678000L, + amount = 106, + payPalNotes = "Notes" + }; litleBatchRequest.addAuthReversal(reversal); - authReversal reversal2 = new authReversal(); - reversal2.litleTxnId = 12345678900L; - reversal2.amount = 106; - reversal2.payPalNotes = "Notes"; + var reversal2 = new authReversal + { + litleTxnId = 12345678900L, + amount = 106, + payPalNotes = "Notes" + }; litleBatchRequest.addAuthReversal(reversal2); - capture capture = new capture(); - capture.litleTxnId = 123456000; - capture.amount = 106; - capture.payPalNotes = "Notes"; + var capture = new capture + { + litleTxnId = 123456000, + amount = 106, + payPalNotes = "Notes" + }; litleBatchRequest.addCapture(capture); - capture capture2 = new capture(); - capture2.litleTxnId = 123456700; - capture2.amount = 106; - capture2.payPalNotes = "Notes"; + var capture2 = new capture + { + litleTxnId = 123456700, + amount = 106, + payPalNotes = "Notes" + }; litleBatchRequest.addCapture(capture2); - captureGivenAuth capturegivenauth = new captureGivenAuth(); - capturegivenauth.amount = 106; - capturegivenauth.orderId = "12344"; - authInformation authInfo = new authInformation(); - DateTime authDate = new DateTime(2002, 10, 9); - authInfo.authDate = authDate; - authInfo.authCode = "543216"; - authInfo.authAmount = 12345; - capturegivenauth.authInformation = authInfo; - capturegivenauth.orderSource = orderSourceType.ecommerce; - capturegivenauth.card = card; - + var capturegivenauth = new captureGivenAuth + { + amount = 106, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + authInformation = new authInformation + { + authDate = new DateTime(2002, 10, 9), + authCode = "543216", + authAmount = 12345 + }, + card = card + }; + litleBatchRequest.addCaptureGivenAuth(capturegivenauth); - captureGivenAuth capturegivenauth2 = new captureGivenAuth(); - capturegivenauth2.amount = 106; - capturegivenauth2.orderId = "12344"; - authInformation authInfo2 = new authInformation(); - authDate = new DateTime(2003, 10, 9); - authInfo2.authDate = authDate; - authInfo2.authCode = "543216"; - authInfo2.authAmount = 12345; - capturegivenauth2.authInformation = authInfo; - capturegivenauth2.orderSource = orderSourceType.ecommerce; - capturegivenauth2.card = card2; + var capturegivenauth2 = new captureGivenAuth + { + amount = 106, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + authInformation = new authInformation + { + authDate = new DateTime(2003, 10, 9), + authCode = "543216", + authAmount = 12345 + }, + card = card2 + }; litleBatchRequest.addCaptureGivenAuth(capturegivenauth2); - credit creditObj = new credit(); - creditObj.amount = 106; - creditObj.orderId = "2111"; - creditObj.orderSource = orderSourceType.ecommerce; - creditObj.card = card; + var creditObj = new credit + { + amount = 106, + orderId = "2111", + orderSource = orderSourceType.ecommerce, + card = card + }; litleBatchRequest.addCredit(creditObj); - credit creditObj2 = new credit(); - creditObj2.amount = 106; - creditObj2.orderId = "2111"; - creditObj2.orderSource = orderSourceType.ecommerce; - creditObj2.card = card2; + var creditObj2 = new credit + { + amount = 106, + orderId = "2111", + orderSource = orderSourceType.ecommerce, + card = card2 + }; litleBatchRequest.addCredit(creditObj2); - echeckCredit echeckcredit = new echeckCredit(); - echeckcredit.amount = 12L; - echeckcredit.orderId = "12345"; - echeckcredit.orderSource = orderSourceType.ecommerce; - echeckType echeck = new echeckType(); - echeck.accType = echeckAccountTypeEnum.Checking; - echeck.accNum = "1099999903"; - echeck.routingNum = "011201995"; - echeck.checkNum = "123455"; - echeckcredit.echeck = echeck; - contact billToAddress = new contact(); - billToAddress.name = "Bob"; - billToAddress.city = "Lowell"; - billToAddress.state = "MA"; - billToAddress.email = "litle.com"; - echeckcredit.billToAddress = billToAddress; + var echeck = new echeckType + { + accType = echeckAccountTypeEnum.Checking, + accNum = "1099999903", + routingNum = "011201995", + checkNum = "123455" + }; + + var billToAddress = new contact + { + name = "Bob", + city = "Lowell", + state = "MA", + email = "litle.com" + }; + + var echeckcredit = new echeckCredit + { + amount = 12L, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeck = echeck, + billToAddress = billToAddress + }; litleBatchRequest.addEcheckCredit(echeckcredit); - echeckCredit echeckcredit2 = new echeckCredit(); - echeckcredit2.amount = 12L; - echeckcredit2.orderId = "12346"; - echeckcredit2.orderSource = orderSourceType.ecommerce; - echeckType echeck2 = new echeckType(); - echeck2.accType = echeckAccountTypeEnum.Checking; - echeck2.accNum = "1099999903"; - echeck2.routingNum = "011201995"; - echeck2.checkNum = "123456"; - echeckcredit2.echeck = echeck2; - contact billToAddress2 = new contact(); - billToAddress2.name = "Mike"; - billToAddress2.city = "Lowell"; - billToAddress2.state = "MA"; - billToAddress2.email = "litle.com"; - echeckcredit2.billToAddress = billToAddress2; + var echeck2 = new echeckType + { + accType = echeckAccountTypeEnum.Checking, + accNum = "1099999903", + routingNum = "011201995", + checkNum = "123456" + }; + + var billToAddress2 = new contact + { + name = "Mike", + city = "Lowell", + state = "MA", + email = "litle.com" + }; + var echeckcredit2 = new echeckCredit + { + amount = 12L, + orderId = "12346", + orderSource = orderSourceType.ecommerce, + echeck = echeck2, + billToAddress = billToAddress2 + }; + litleBatchRequest.addEcheckCredit(echeckcredit2); - echeckRedeposit echeckredeposit = new echeckRedeposit(); - echeckredeposit.litleTxnId = 123456; - echeckredeposit.echeck = echeck; + var echeckredeposit = new echeckRedeposit + { + litleTxnId = 123456, + echeck = echeck + }; litleBatchRequest.addEcheckRedeposit(echeckredeposit); - echeckRedeposit echeckredeposit2 = new echeckRedeposit(); - echeckredeposit2.litleTxnId = 123457; - echeckredeposit2.echeck = echeck2; + var echeckredeposit2 = new echeckRedeposit + { + litleTxnId = 123457, + echeck = echeck2 + }; litleBatchRequest.addEcheckRedeposit(echeckredeposit2); - echeckSale echeckSaleObj = new echeckSale(); - echeckSaleObj.amount = 123456; - echeckSaleObj.orderId = "12345"; - echeckSaleObj.orderSource = orderSourceType.ecommerce; - echeckSaleObj.echeck = echeck; - echeckSaleObj.billToAddress = billToAddress; + var echeckSaleObj = new echeckSale + { + amount = 123456, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeck = echeck, + billToAddress = billToAddress + }; litleBatchRequest.addEcheckSale(echeckSaleObj); - echeckSale echeckSaleObj2 = new echeckSale(); - echeckSaleObj2.amount = 123456; - echeckSaleObj2.orderId = "12346"; - echeckSaleObj2.orderSource = orderSourceType.ecommerce; - echeckSaleObj2.echeck = echeck2; - echeckSaleObj2.billToAddress = billToAddress2; + var echeckSaleObj2 = new echeckSale + { + amount = 123456, + orderId = "12346", + orderSource = orderSourceType.ecommerce, + echeck = echeck2, + billToAddress = billToAddress2 + }; litleBatchRequest.addEcheckSale(echeckSaleObj2); - echeckPreNoteSale echeckPreNoteSaleObj1 = new echeckPreNoteSale(); - echeckPreNoteSaleObj1.orderId = "12345"; - echeckPreNoteSaleObj1.orderSource = orderSourceType.ecommerce; - echeckPreNoteSaleObj1.echeck = echeck; - echeckPreNoteSaleObj1.billToAddress = billToAddress; + var echeckPreNoteSaleObj1 = new echeckPreNoteSale + { + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeck = echeck, + billToAddress = billToAddress + }; litleBatchRequest.addEcheckPreNoteSale(echeckPreNoteSaleObj1); - echeckPreNoteSale echeckPreNoteSaleObj2 = new echeckPreNoteSale(); - echeckPreNoteSaleObj2.orderId = "12345"; - echeckPreNoteSaleObj2.orderSource = orderSourceType.ecommerce; - echeckPreNoteSaleObj2.echeck = echeck2; - echeckPreNoteSaleObj2.billToAddress = billToAddress2; + var echeckPreNoteSaleObj2 = new echeckPreNoteSale + { + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeck = echeck2, + billToAddress = billToAddress2 + }; litleBatchRequest.addEcheckPreNoteSale(echeckPreNoteSaleObj2); - echeckPreNoteCredit echeckPreNoteCreditObj1 = new echeckPreNoteCredit(); - echeckPreNoteCreditObj1.orderId = "12345"; - echeckPreNoteCreditObj1.orderSource = orderSourceType.ecommerce; - echeckPreNoteCreditObj1.echeck = echeck; - echeckPreNoteCreditObj1.billToAddress = billToAddress; + var echeckPreNoteCreditObj1 = new echeckPreNoteCredit + { + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeck = echeck, + billToAddress = billToAddress + }; litleBatchRequest.addEcheckPreNoteCredit(echeckPreNoteCreditObj1); - echeckPreNoteCredit echeckPreNoteCreditObj2 = new echeckPreNoteCredit(); - echeckPreNoteCreditObj2.orderId = "12345"; - echeckPreNoteCreditObj2.orderSource = orderSourceType.ecommerce; - echeckPreNoteCreditObj2.echeck = echeck2; - echeckPreNoteCreditObj2.billToAddress = billToAddress2; +// var echeckPreNoteCreditObj2 = new echeckPreNoteCredit +// { +// orderId = "12345", +// orderSource = orderSourceType.ecommerce, +// echeck = echeck2, +// billToAddress = billToAddress2 +// }; - echeckVerification echeckVerificationObject = new echeckVerification(); - echeckVerificationObject.amount = 123456; - echeckVerificationObject.orderId = "12345"; - echeckVerificationObject.orderSource = orderSourceType.ecommerce; - echeckVerificationObject.echeck = echeck; - echeckVerificationObject.billToAddress = billToAddress; + var echeckVerificationObject = new echeckVerification + { + amount = 123456, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeck = echeck, + billToAddress = billToAddress + }; litleBatchRequest.addEcheckVerification(echeckVerificationObject); - echeckVerification echeckVerificationObject2 = new echeckVerification(); - echeckVerificationObject2.amount = 123456; - echeckVerificationObject2.orderId = "12346"; - echeckVerificationObject2.orderSource = orderSourceType.ecommerce; - echeckVerificationObject2.echeck = echeck2; - echeckVerificationObject2.billToAddress = billToAddress2; + var echeckVerificationObject2 = new echeckVerification + { + amount = 123456, + orderId = "12346", + orderSource = orderSourceType.ecommerce, + echeck = echeck2, + billToAddress = billToAddress2 + }; litleBatchRequest.addEcheckVerification(echeckVerificationObject2); - forceCapture forcecapture = new forceCapture(); - forcecapture.amount = 106; - forcecapture.orderId = "12344"; - forcecapture.orderSource = orderSourceType.ecommerce; - forcecapture.card = card; + var forcecapture = new forceCapture + { + amount = 106, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + card = card + }; litleBatchRequest.addForceCapture(forcecapture); - forceCapture forcecapture2 = new forceCapture(); - forcecapture2.amount = 106; - forcecapture2.orderId = "12345"; - forcecapture2.orderSource = orderSourceType.ecommerce; - forcecapture2.card = card2; + var forcecapture2 = new forceCapture + { + amount = 106, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + card = card2 + }; litleBatchRequest.addForceCapture(forcecapture2); - sale saleObj = new sale(); - saleObj.amount = 106; - saleObj.litleTxnId = 123456; - saleObj.orderId = "12344"; - saleObj.orderSource = orderSourceType.ecommerce; - saleObj.card = card; + var saleObj = new sale + { + amount = 106, + litleTxnId = 123456, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + card = card + }; litleBatchRequest.addSale(saleObj); - sale saleObj2 = new sale(); - saleObj2.amount = 106; - saleObj2.litleTxnId = 123456; - saleObj2.orderId = "12345"; - saleObj2.orderSource = orderSourceType.ecommerce; - saleObj2.card = card2; + var saleObj2 = new sale + { + amount = 106, + litleTxnId = 123456, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + card = card2 + }; litleBatchRequest.addSale(saleObj2); - registerTokenRequestType registerTokenRequest = new registerTokenRequestType(); - registerTokenRequest.orderId = "12344"; - registerTokenRequest.accountNumber = "1233456789103801"; - registerTokenRequest.reportGroup = "Planets"; + var registerTokenRequest = new registerTokenRequestType + { + orderId = "12344", + accountNumber = "1233456789103801", + reportGroup = "Planets" + }; litleBatchRequest.addRegisterTokenRequest(registerTokenRequest); - registerTokenRequestType registerTokenRequest2 = new registerTokenRequestType(); - registerTokenRequest2.orderId = "12345"; - registerTokenRequest2.accountNumber = "1233456789103801"; - registerTokenRequest2.reportGroup = "Planets"; + var registerTokenRequest2 = new registerTokenRequestType + { + orderId = "12345", + accountNumber = "1233456789103801", + reportGroup = "Planets" + }; litleBatchRequest.addRegisterTokenRequest(registerTokenRequest2); - updateCardValidationNumOnToken updateCardValidationNumOnToken = new updateCardValidationNumOnToken(); - updateCardValidationNumOnToken.orderId = "12344"; - updateCardValidationNumOnToken.cardValidationNum = "123"; - updateCardValidationNumOnToken.litleToken = "4100000000000001"; + var updateCardValidationNumOnToken = new updateCardValidationNumOnToken + { + orderId = "12344", + cardValidationNum = "123", + litleToken = "4100000000000001" + }; litleBatchRequest.addUpdateCardValidationNumOnToken(updateCardValidationNumOnToken); - updateCardValidationNumOnToken updateCardValidationNumOnToken2 = new updateCardValidationNumOnToken(); - updateCardValidationNumOnToken2.orderId = "12345"; - updateCardValidationNumOnToken2.cardValidationNum = "123"; - updateCardValidationNumOnToken2.litleToken = "4242424242424242"; + var updateCardValidationNumOnToken2 = new updateCardValidationNumOnToken + { + orderId = "12345", + cardValidationNum = "123", + litleToken = "4242424242424242" + }; litleBatchRequest.addUpdateCardValidationNumOnToken(updateCardValidationNumOnToken2); - litle.addBatch(litleBatchRequest); + _litle.addBatch(litleBatchRequest); - string batchName = litle.sendToLitle(); + var batchName = _litle.sendToLitle(); - litle.blockAndWaitForResponse(batchName, estimatedResponseTime(2 * 2, 10 * 2)); + _litle.blockAndWaitForResponse(batchName, EstimatedResponseTime(2 * 2, 10 * 2)); - litleResponse litleResponse = litle.receiveFromLitle(batchName); + var litleResponse = _litle.receiveFromLitle(batchName); Assert.NotNull(litleResponse); Assert.AreEqual("0", litleResponse.response); Assert.AreEqual("Valid Format", litleResponse.message); - batchResponse litleBatchResponse = litleResponse.nextBatchResponse(); + var litleBatchResponse = litleResponse.nextBatchResponse(); while (litleBatchResponse != null) { - authorizationResponse authorizationResponse = litleBatchResponse.nextAuthorizationResponse(); + var authorizationResponse = litleBatchResponse.nextAuthorizationResponse(); while (authorizationResponse != null) { Assert.AreEqual("000", authorizationResponse.response); @@ -363,7 +441,7 @@ public void SimpleBatch() authorizationResponse = litleBatchResponse.nextAuthorizationResponse(); } - authReversalResponse authReversalResponse = litleBatchResponse.nextAuthReversalResponse(); + var authReversalResponse = litleBatchResponse.nextAuthReversalResponse(); while (authReversalResponse != null) { Assert.AreEqual("360", authReversalResponse.response); @@ -371,7 +449,7 @@ public void SimpleBatch() authReversalResponse = litleBatchResponse.nextAuthReversalResponse(); } - captureResponse captureResponse = litleBatchResponse.nextCaptureResponse(); + var captureResponse = litleBatchResponse.nextCaptureResponse(); while (captureResponse != null) { Assert.AreEqual("360", captureResponse.response); @@ -379,7 +457,7 @@ public void SimpleBatch() captureResponse = litleBatchResponse.nextCaptureResponse(); } - captureGivenAuthResponse captureGivenAuthResponse = litleBatchResponse.nextCaptureGivenAuthResponse(); + var captureGivenAuthResponse = litleBatchResponse.nextCaptureGivenAuthResponse(); while (captureGivenAuthResponse != null) { Assert.AreEqual("000", captureGivenAuthResponse.response); @@ -387,7 +465,7 @@ public void SimpleBatch() captureGivenAuthResponse = litleBatchResponse.nextCaptureGivenAuthResponse(); } - creditResponse creditResponse = litleBatchResponse.nextCreditResponse(); + var creditResponse = litleBatchResponse.nextCreditResponse(); while (creditResponse != null) { Assert.AreEqual("000", creditResponse.response); @@ -395,7 +473,7 @@ public void SimpleBatch() creditResponse = litleBatchResponse.nextCreditResponse(); } - echeckCreditResponse echeckCreditResponse = litleBatchResponse.nextEcheckCreditResponse(); + var echeckCreditResponse = litleBatchResponse.nextEcheckCreditResponse(); while (echeckCreditResponse != null) { Assert.AreEqual("000", echeckCreditResponse.response); @@ -403,7 +481,7 @@ public void SimpleBatch() echeckCreditResponse = litleBatchResponse.nextEcheckCreditResponse(); } - echeckRedepositResponse echeckRedepositResponse = litleBatchResponse.nextEcheckRedepositResponse(); + var echeckRedepositResponse = litleBatchResponse.nextEcheckRedepositResponse(); while (echeckRedepositResponse != null) { Assert.AreEqual("360", echeckRedepositResponse.response); @@ -411,7 +489,7 @@ public void SimpleBatch() echeckRedepositResponse = litleBatchResponse.nextEcheckRedepositResponse(); } - echeckSalesResponse echeckSalesResponse = litleBatchResponse.nextEcheckSalesResponse(); + var echeckSalesResponse = litleBatchResponse.nextEcheckSalesResponse(); while (echeckSalesResponse != null) { Assert.AreEqual("000", echeckSalesResponse.response); @@ -419,7 +497,7 @@ public void SimpleBatch() echeckSalesResponse = litleBatchResponse.nextEcheckSalesResponse(); } - echeckPreNoteSaleResponse echeckPreNoteSaleResponse = litleBatchResponse.nextEcheckPreNoteSaleResponse(); + var echeckPreNoteSaleResponse = litleBatchResponse.nextEcheckPreNoteSaleResponse(); while (echeckPreNoteSaleResponse != null) { Assert.AreEqual("000", echeckPreNoteSaleResponse.response); @@ -427,7 +505,7 @@ public void SimpleBatch() echeckPreNoteSaleResponse = litleBatchResponse.nextEcheckPreNoteSaleResponse(); } - echeckPreNoteCreditResponse echeckPreNoteCreditResponse = litleBatchResponse.nextEcheckPreNoteCreditResponse(); + var echeckPreNoteCreditResponse = litleBatchResponse.nextEcheckPreNoteCreditResponse(); while (echeckPreNoteCreditResponse != null) { Assert.AreEqual("000", echeckPreNoteCreditResponse.response); @@ -435,7 +513,7 @@ public void SimpleBatch() echeckPreNoteCreditResponse = litleBatchResponse.nextEcheckPreNoteCreditResponse(); } - echeckVerificationResponse echeckVerificationResponse = litleBatchResponse.nextEcheckVerificationResponse(); + var echeckVerificationResponse = litleBatchResponse.nextEcheckVerificationResponse(); while (echeckVerificationResponse != null) { Assert.AreEqual("957", echeckVerificationResponse.response); @@ -443,7 +521,7 @@ public void SimpleBatch() echeckVerificationResponse = litleBatchResponse.nextEcheckVerificationResponse(); } - forceCaptureResponse forceCaptureResponse = litleBatchResponse.nextForceCaptureResponse(); + var forceCaptureResponse = litleBatchResponse.nextForceCaptureResponse(); while (forceCaptureResponse != null) { Assert.AreEqual("000", forceCaptureResponse.response); @@ -451,7 +529,7 @@ public void SimpleBatch() forceCaptureResponse = litleBatchResponse.nextForceCaptureResponse(); } - registerTokenResponse registerTokenResponse = litleBatchResponse.nextRegisterTokenResponse(); + var registerTokenResponse = litleBatchResponse.nextRegisterTokenResponse(); while (registerTokenResponse != null) { Assert.AreEqual("820", registerTokenResponse.response); @@ -459,7 +537,7 @@ public void SimpleBatch() registerTokenResponse = litleBatchResponse.nextRegisterTokenResponse(); } - saleResponse saleResponse = litleBatchResponse.nextSaleResponse(); + var saleResponse = litleBatchResponse.nextSaleResponse(); while (saleResponse != null) { Assert.AreEqual("000", saleResponse.response); @@ -467,7 +545,7 @@ public void SimpleBatch() saleResponse = litleBatchResponse.nextSaleResponse(); } - updateCardValidationNumOnTokenResponse updateCardValidationNumOnTokenResponse = litleBatchResponse.nextUpdateCardValidationNumOnTokenResponse(); + var updateCardValidationNumOnTokenResponse = litleBatchResponse.nextUpdateCardValidationNumOnTokenResponse(); while (updateCardValidationNumOnTokenResponse != null) { Assert.AreEqual("823", updateCardValidationNumOnTokenResponse.response); @@ -480,41 +558,48 @@ public void SimpleBatch() } [Test] - public void accountUpdateBatch() + public void AccountUpdateBatch() { - batchRequest litleBatchRequest = new batchRequest(); + var litleBatchRequest = new batchRequest(); - accountUpdate accountUpdate1 = new accountUpdate(); - accountUpdate1.orderId = "1111"; - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.VI; - card.number = "414100000000000000"; - card.expDate = "1210"; - accountUpdate1.card = card; + var card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "414100000000000000", + expDate = "1210" + }; + var accountUpdate1 = new accountUpdate + { + orderId = "1111", + card = card + }; + litleBatchRequest.addAccountUpdate(accountUpdate1); - accountUpdate accountUpdate2 = new accountUpdate(); - accountUpdate2.orderId = "1112"; - accountUpdate2.card = card; + var accountUpdate2 = new accountUpdate + { + orderId = "1112", + card = card + }; litleBatchRequest.addAccountUpdate(accountUpdate2); - litle.addBatch(litleBatchRequest); - string batchName = litle.sendToLitle(); + _litle.addBatch(litleBatchRequest); + var batchName = _litle.sendToLitle(); - litle.blockAndWaitForResponse(batchName, estimatedResponseTime(0, 1 * 2)); + _litle.blockAndWaitForResponse(batchName, EstimatedResponseTime(0, 1 * 2)); - litleResponse litleResponse = litle.receiveFromLitle(batchName); + var litleResponse = _litle.receiveFromLitle(batchName); Assert.NotNull(litleResponse); Assert.AreEqual("0", litleResponse.response); Assert.AreEqual("Valid Format", litleResponse.message); - batchResponse litleBatchResponse = litleResponse.nextBatchResponse(); + var litleBatchResponse = litleResponse.nextBatchResponse(); while (litleBatchResponse != null) { - accountUpdateResponse accountUpdateResponse = litleBatchResponse.nextAccountUpdateResponse(); + var accountUpdateResponse = litleBatchResponse.nextAccountUpdateResponse(); while (accountUpdateResponse != null) { Assert.AreEqual("301", accountUpdateResponse.response); @@ -526,39 +611,45 @@ public void accountUpdateBatch() } [Test] - public void RFRBatch() + public void RfrBatch() { - batchRequest litleBatchRequest = new batchRequest(); - litleBatchRequest.id = "1234567A"; + var litleBatchRequest = new batchRequest {id = "1234567A"}; - accountUpdate accountUpdate1 = new accountUpdate(); - accountUpdate1.orderId = "1111"; - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.VI; - card.number = "4242424242424242"; - card.expDate = "1210"; - accountUpdate1.card = card; + var card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4242424242424242", + expDate = "1210" + }; + var accountUpdate1 = new accountUpdate + { + orderId = "1111", + card = card + }; + litleBatchRequest.addAccountUpdate(accountUpdate1); - accountUpdate accountUpdate2 = new accountUpdate(); - accountUpdate2.orderId = "1112"; - accountUpdate2.card = card; + var accountUpdate2 = new accountUpdate + { + orderId = "1112", + card = card + }; litleBatchRequest.addAccountUpdate(accountUpdate2); - litle.addBatch(litleBatchRequest); + _litle.addBatch(litleBatchRequest); - string batchName = litle.sendToLitle(); - litle.blockAndWaitForResponse(batchName, estimatedResponseTime(0, 1 * 2)); - litleResponse litleResponse = litle.receiveFromLitle(batchName); + var batchName = _litle.sendToLitle(); + _litle.blockAndWaitForResponse(batchName, EstimatedResponseTime(0, 1 * 2)); + var litleResponse = _litle.receiveFromLitle(batchName); Assert.NotNull(litleResponse); - batchResponse litleBatchResponse = litleResponse.nextBatchResponse(); + var litleBatchResponse = litleResponse.nextBatchResponse(); Assert.NotNull(litleBatchResponse); while (litleBatchResponse != null) { - accountUpdateResponse accountUpdateResponse = litleBatchResponse.nextAccountUpdateResponse(); + var accountUpdateResponse = litleBatchResponse.nextAccountUpdateResponse(); Assert.NotNull(accountUpdateResponse); while (accountUpdateResponse != null) { @@ -569,23 +660,26 @@ public void RFRBatch() litleBatchResponse = litleResponse.nextBatchResponse(); } - litleRequest litleRfr = new litleRequest(); - RFRRequest rfrRequest = new RFRRequest(); - accountUpdateFileRequestData accountUpdateFileRequestData = new accountUpdateFileRequestData(); - accountUpdateFileRequestData.merchantId = Properties.Settings.Default.merchantId; - accountUpdateFileRequestData.postDay = DateTime.Now; - rfrRequest.accountUpdateFileRequestData = accountUpdateFileRequestData; - + var litleRfr = new litleRequest(); + var rfrRequest = new RFRRequest + { + accountUpdateFileRequestData = new accountUpdateFileRequestData + { + merchantId = Properties.Settings.Default.merchantId, + postDay = DateTime.Now + } + }; + litleRfr.addRFRRequest(rfrRequest); - string rfrBatchName = litleRfr.sendToLitle(); + var rfrBatchName = litleRfr.sendToLitle(); try { - litle.blockAndWaitForResponse(rfrBatchName, 120000); - litleResponse litleRfrResponse = litle.receiveFromLitle(rfrBatchName); + _litle.blockAndWaitForResponse(rfrBatchName, 120000); + var litleRfrResponse = _litle.receiveFromLitle(rfrBatchName); Assert.NotNull(litleRfrResponse); - RFRResponse rfrResponse = litleRfrResponse.nextRFRResponse(); + var rfrResponse = litleRfrResponse.nextRFRResponse(); Assert.NotNull(rfrResponse); while (rfrResponse != null) { @@ -594,233 +688,266 @@ public void RFRBatch() rfrResponse = litleResponse.nextRFRResponse(); } } - catch (Exception) + catch (Exception e) { + Console.WriteLine("Exception handled <" + e.Message + ">"); } } [Test] - public void nullBatchData() + public void NullBatchData() { - batchRequest litleBatchRequest = new batchRequest(); - - authorization authorization = new authorization(); - authorization.reportGroup = "Planets"; - authorization.orderId = "12344"; - authorization.amount = 106; - authorization.orderSource = orderSourceType.ecommerce; - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.VI; - card.number = "414100000000000000"; - card.expDate = "1210"; - authorization.card = card; + var litleBatchRequest = new batchRequest(); + + var card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "414100000000000000", + expDate = "1210" + }; + var authorization = new authorization + { + reportGroup = "Planets", + orderId = "12344", + amount = 106, + orderSource = orderSourceType.ecommerce, + card = card + }; litleBatchRequest.addAuthorization(authorization); try { litleBatchRequest.addAuthorization(null); } - catch (System.NullReferenceException e) + catch (NullReferenceException e) { Assert.AreEqual("Object reference not set to an instance of an object.", e.Message); } - authReversal reversal = new authReversal(); - reversal.litleTxnId = 12345678000L; - reversal.amount = 106; - reversal.payPalNotes = "Notes"; + var reversal = new authReversal + { + litleTxnId = 12345678000L, + amount = 106, + payPalNotes = "Notes" + }; litleBatchRequest.addAuthReversal(reversal); try { litleBatchRequest.addAuthReversal(null); } - catch (System.NullReferenceException e) + catch (NullReferenceException e) { Assert.AreEqual("Object reference not set to an instance of an object.", e.Message); } - capture capture = new capture(); - capture.litleTxnId = 123456000; - capture.amount = 106; - capture.payPalNotes = "Notes"; + var capture = new capture + { + litleTxnId = 123456000, + amount = 106, + payPalNotes = "Notes" + }; litleBatchRequest.addCapture(capture); try { litleBatchRequest.addCapture(null); } - catch (System.NullReferenceException e) + catch (NullReferenceException e) { Assert.AreEqual("Object reference not set to an instance of an object.", e.Message); } - captureGivenAuth capturegivenauth = new captureGivenAuth(); - capturegivenauth.amount = 106; - capturegivenauth.orderId = "12344"; - authInformation authInfo = new authInformation(); - DateTime authDate = new DateTime(2002, 10, 9); - authInfo.authDate = authDate; - authInfo.authCode = "543216"; - authInfo.authAmount = 12345; - capturegivenauth.authInformation = authInfo; - capturegivenauth.orderSource = orderSourceType.ecommerce; - capturegivenauth.card = card; - + var capturegivenauth = new captureGivenAuth + { + amount = 106, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + authInformation = new authInformation + { + authDate = new DateTime(2002, 10, 9), + authCode = "543216", + authAmount = 12345 + }, + card = card + }; + litleBatchRequest.addCaptureGivenAuth(capturegivenauth); try { litleBatchRequest.addCaptureGivenAuth(null); } - catch (System.NullReferenceException e) + catch (NullReferenceException e) { Assert.AreEqual("Object reference not set to an instance of an object.", e.Message); } - credit creditObj = new credit(); - creditObj.amount = 106; - creditObj.orderId = "2111"; - creditObj.orderSource = orderSourceType.ecommerce; - creditObj.card = card; + var creditObj = new credit + { + amount = 106, + orderId = "2111", + orderSource = orderSourceType.ecommerce, + card = card + }; litleBatchRequest.addCredit(creditObj); try { litleBatchRequest.addCredit(null); } - catch (System.NullReferenceException e) + catch (NullReferenceException e) { Assert.AreEqual("Object reference not set to an instance of an object.", e.Message); } - echeckCredit echeckcredit = new echeckCredit(); - echeckcredit.amount = 12L; - echeckcredit.orderId = "12345"; - echeckcredit.orderSource = orderSourceType.ecommerce; - echeckType echeck = new echeckType(); - echeck.accType = echeckAccountTypeEnum.Checking; - echeck.accNum = "12345657890"; - echeck.routingNum = "011201995"; - echeck.checkNum = "123455"; - echeckcredit.echeck = echeck; - contact billToAddress = new contact(); - billToAddress.name = "Bob"; - billToAddress.city = "Lowell"; - billToAddress.state = "MA"; - billToAddress.email = "litle.com"; - echeckcredit.billToAddress = billToAddress; + var echeck = new echeckType + { + accType = echeckAccountTypeEnum.Checking, + accNum = "12345657890", + routingNum = "011201995", + checkNum = "123455" + }; + + var billToAddress = new contact + { + name = "Bob", + city = "Lowell", + state = "MA", + email = "litle.com" + }; + var echeckcredit = new echeckCredit + { + amount = 12L, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeck = echeck, + billToAddress = billToAddress + }; + litleBatchRequest.addEcheckCredit(echeckcredit); try { litleBatchRequest.addEcheckCredit(null); } - catch (System.NullReferenceException e) + catch (NullReferenceException e) { Assert.AreEqual("Object reference not set to an instance of an object.", e.Message); } - echeckRedeposit echeckredeposit = new echeckRedeposit(); - echeckredeposit.litleTxnId = 123456; - echeckredeposit.echeck = echeck; + var echeckredeposit = new echeckRedeposit + { + litleTxnId = 123456, + echeck = echeck + }; litleBatchRequest.addEcheckRedeposit(echeckredeposit); try { litleBatchRequest.addEcheckRedeposit(null); } - catch (System.NullReferenceException e) + catch (NullReferenceException e) { Assert.AreEqual("Object reference not set to an instance of an object.", e.Message); } - echeckSale echeckSaleObj = new echeckSale(); - echeckSaleObj.amount = 123456; - echeckSaleObj.orderId = "12345"; - echeckSaleObj.orderSource = orderSourceType.ecommerce; - echeckSaleObj.echeck = echeck; - echeckSaleObj.billToAddress = billToAddress; + var echeckSaleObj = new echeckSale + { + amount = 123456, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeck = echeck, + billToAddress = billToAddress + }; litleBatchRequest.addEcheckSale(echeckSaleObj); try { litleBatchRequest.addEcheckSale(null); } - catch (System.NullReferenceException e) + catch (NullReferenceException e) { Assert.AreEqual("Object reference not set to an instance of an object.", e.Message); } - echeckVerification echeckVerificationObject = new echeckVerification(); - echeckVerificationObject.amount = 123456; - echeckVerificationObject.orderId = "12345"; - echeckVerificationObject.orderSource = orderSourceType.ecommerce; - echeckVerificationObject.echeck = echeck; - echeckVerificationObject.billToAddress = billToAddress; + var echeckVerificationObject = new echeckVerification + { + amount = 123456, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeck = echeck, + billToAddress = billToAddress + }; litleBatchRequest.addEcheckVerification(echeckVerificationObject); try { litleBatchRequest.addEcheckVerification(null); } - catch (System.NullReferenceException e) + catch (NullReferenceException e) { Assert.AreEqual("Object reference not set to an instance of an object.", e.Message); } - forceCapture forcecapture = new forceCapture(); - forcecapture.amount = 106; - forcecapture.orderId = "12344"; - forcecapture.orderSource = orderSourceType.ecommerce; - forcecapture.card = card; + var forcecapture = new forceCapture + { + amount = 106, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + card = card + }; litleBatchRequest.addForceCapture(forcecapture); try { litleBatchRequest.addForceCapture(null); } - catch (System.NullReferenceException e) + catch (NullReferenceException e) { Assert.AreEqual("Object reference not set to an instance of an object.", e.Message); } - sale saleObj = new sale(); - saleObj.amount = 106; - saleObj.litleTxnId = 123456; - saleObj.orderId = "12344"; - saleObj.orderSource = orderSourceType.ecommerce; - saleObj.card = card; + var saleObj = new sale + { + amount = 106, + litleTxnId = 123456, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + card = card + }; litleBatchRequest.addSale(saleObj); try { litleBatchRequest.addSale(null); } - catch (System.NullReferenceException e) + catch (NullReferenceException e) { Assert.AreEqual("Object reference not set to an instance of an object.", e.Message); } - registerTokenRequestType registerTokenRequest = new registerTokenRequestType(); - registerTokenRequest.orderId = "12344"; - registerTokenRequest.accountNumber = "1233456789103801"; - registerTokenRequest.reportGroup = "Planets"; + var registerTokenRequest = new registerTokenRequestType + { + orderId = "12344", + accountNumber = "1233456789103801", + reportGroup = "Planets" + }; litleBatchRequest.addRegisterTokenRequest(registerTokenRequest); try { litleBatchRequest.addRegisterTokenRequest(null); } - catch (System.NullReferenceException e) + catch (NullReferenceException e) { Assert.AreEqual("Object reference not set to an instance of an object.", e.Message); } try { - litle.addBatch(litleBatchRequest); + _litle.addBatch(litleBatchRequest); } - catch (System.NullReferenceException e) + catch (NullReferenceException e) { Assert.AreEqual("Object reference not set to an instance of an object.", e.Message); } @@ -829,251 +956,314 @@ public void nullBatchData() [Test] public void InvalidCredientialsBatch() { - litleRequest litleIC = new litleRequest(invalidConfig); + var litleIc = new litleRequest(_invalidConfig); - batchRequest litleBatchRequest = new batchRequest(); + var litleBatchRequest = new batchRequest(); - authorization authorization = new authorization(); - authorization.reportGroup = "Planets"; - authorization.orderId = "12344"; - authorization.amount = 106; - authorization.orderSource = orderSourceType.ecommerce; - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.VI; - card.number = "4100000000000001"; - card.expDate = "1210"; - authorization.card = card; //This needs to compile + var card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000001", + expDate = "1210" + }; - litleBatchRequest.addAuthorization(authorization); + var card2 = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4242424242424242", + expDate = "1210" + }; - authorization authorization2 = new authorization(); - authorization2.reportGroup = "Planets"; - authorization2.orderId = "12345"; - authorization2.amount = 106; - authorization2.orderSource = orderSourceType.ecommerce; - cardType card2 = new cardType(); - card2.type = methodOfPaymentTypeEnum.VI; - card2.number = "4242424242424242"; - card2.expDate = "1210"; - authorization2.card = card2; //This needs to compile + var authorization = new authorization + { + reportGroup = "Planets", + orderId = "12344", + amount = 106, + orderSource = orderSourceType.ecommerce, + card = card + }; + + litleBatchRequest.addAuthorization(authorization); - litleBatchRequest.addAuthorization(authorization2); + var authorization2 = new authorization + { + reportGroup = "Planets", + orderId = "12345", + amount = 106, + orderSource = orderSourceType.ecommerce, + card = card2 + }; + + litleBatchRequest.addAuthorization(authorization2); - authReversal reversal = new authReversal(); - reversal.litleTxnId = 12345678000L; - reversal.amount = 106; - reversal.payPalNotes = "Notes"; + var reversal = new authReversal + { + litleTxnId = 12345678000L, + amount = 106, + payPalNotes = "Notes" + }; litleBatchRequest.addAuthReversal(reversal); - authReversal reversal2 = new authReversal(); - reversal2.litleTxnId = 12345678900L; - reversal2.amount = 106; - reversal2.payPalNotes = "Notes"; + var reversal2 = new authReversal + { + litleTxnId = 12345678900L, + amount = 106, + payPalNotes = "Notes" + }; litleBatchRequest.addAuthReversal(reversal2); - capture capture = new capture(); - capture.litleTxnId = 123456000; - capture.amount = 106; - capture.payPalNotes = "Notes"; + var capture = new capture + { + litleTxnId = 123456000, + amount = 106, + payPalNotes = "Notes" + }; litleBatchRequest.addCapture(capture); - capture capture2 = new capture(); - capture2.litleTxnId = 123456700; - capture2.amount = 106; - capture2.payPalNotes = "Notes"; + var capture2 = new capture + { + litleTxnId = 123456700, + amount = 106, + payPalNotes = "Notes" + }; litleBatchRequest.addCapture(capture2); - captureGivenAuth capturegivenauth = new captureGivenAuth(); - capturegivenauth.amount = 106; - capturegivenauth.orderId = "12344"; - authInformation authInfo = new authInformation(); - DateTime authDate = new DateTime(2002, 10, 9); - authInfo.authDate = authDate; - authInfo.authCode = "543216"; - authInfo.authAmount = 12345; - capturegivenauth.authInformation = authInfo; - capturegivenauth.orderSource = orderSourceType.ecommerce; - capturegivenauth.card = card; + var authInfo = new authInformation + { + authDate = new DateTime(2002, 10, 9), + authCode = "543216", + authAmount = 12345 + }; + var capturegivenauth = new captureGivenAuth + { + amount = 106, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + authInformation = authInfo, + card = card + }; + litleBatchRequest.addCaptureGivenAuth(capturegivenauth); - captureGivenAuth capturegivenauth2 = new captureGivenAuth(); - capturegivenauth2.amount = 106; - capturegivenauth2.orderId = "12344"; - authInformation authInfo2 = new authInformation(); - authDate = new DateTime(2003, 10, 9); - authInfo2.authDate = authDate; - authInfo2.authCode = "543216"; - authInfo2.authAmount = 12345; - capturegivenauth2.authInformation = authInfo; - capturegivenauth2.orderSource = orderSourceType.ecommerce; - capturegivenauth2.card = card2; - + var capturegivenauth2 = new captureGivenAuth + { + amount = 106, + orderId = "12344", + authInformation = authInfo, + orderSource = orderSourceType.ecommerce, + card = card2 + }; + litleBatchRequest.addCaptureGivenAuth(capturegivenauth2); - credit creditObj = new credit(); - creditObj.amount = 106; - creditObj.orderId = "2111"; - creditObj.orderSource = orderSourceType.ecommerce; - creditObj.card = card; + var creditObj = new credit + { + amount = 106, + orderId = "2111", + orderSource = orderSourceType.ecommerce, + card = card + }; litleBatchRequest.addCredit(creditObj); - credit creditObj2 = new credit(); - creditObj2.amount = 106; - creditObj2.orderId = "2111"; - creditObj2.orderSource = orderSourceType.ecommerce; - creditObj2.card = card2; + var creditObj2 = new credit + { + amount = 106, + orderId = "2111", + orderSource = orderSourceType.ecommerce, + card = card2 + }; litleBatchRequest.addCredit(creditObj2); - echeckCredit echeckcredit = new echeckCredit(); - echeckcredit.amount = 12L; - echeckcredit.orderId = "12345"; - echeckcredit.orderSource = orderSourceType.ecommerce; - echeckType echeck = new echeckType(); - echeck.accType = echeckAccountTypeEnum.Checking; - echeck.accNum = "1099999903"; - echeck.routingNum = "011201995"; - echeck.checkNum = "123455"; - echeckcredit.echeck = echeck; - contact billToAddress = new contact(); - billToAddress.name = "Bob"; - billToAddress.city = "Lowell"; - billToAddress.state = "MA"; - billToAddress.email = "litle.com"; - echeckcredit.billToAddress = billToAddress; + var echeck = new echeckType + { + accType = echeckAccountTypeEnum.Checking, + accNum = "1099999903", + routingNum = "011201995", + checkNum = "123455" + }; + + var billToAddress = new contact + { + name = "Bob", + city = "Lowell", + state = "MA", + email = "litle.com" + }; + + var echeckcredit = new echeckCredit + { + amount = 12L, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeck = echeck, + billToAddress = billToAddress + }; litleBatchRequest.addEcheckCredit(echeckcredit); - echeckCredit echeckcredit2 = new echeckCredit(); - echeckcredit2.amount = 12L; - echeckcredit2.orderId = "12346"; - echeckcredit2.orderSource = orderSourceType.ecommerce; - echeckType echeck2 = new echeckType(); - echeck2.accType = echeckAccountTypeEnum.Checking; - echeck2.accNum = "1099999903"; - echeck2.routingNum = "011201995"; - echeck2.checkNum = "123456"; - echeckcredit2.echeck = echeck2; - contact billToAddress2 = new contact(); - billToAddress2.name = "Mike"; - billToAddress2.city = "Lowell"; - billToAddress2.state = "MA"; - billToAddress2.email = "litle.com"; - echeckcredit2.billToAddress = billToAddress2; + var echeck2 = new echeckType + { + accType = echeckAccountTypeEnum.Checking, + accNum = "1099999903", + routingNum = "011201995", + checkNum = "123456" + }; + + var billToAddress2 = new contact + { + name = "Mike", + city = "Lowell", + state = "MA", + email = "litle.com" + }; + + var echeckcredit2 = new echeckCredit + { + amount = 12L, + orderId = "12346", + orderSource = orderSourceType.ecommerce, + echeck = echeck2, + billToAddress = billToAddress2 + }; litleBatchRequest.addEcheckCredit(echeckcredit2); - echeckRedeposit echeckredeposit = new echeckRedeposit(); - echeckredeposit.litleTxnId = 123456; - echeckredeposit.echeck = echeck; + var echeckredeposit = new echeckRedeposit + { + litleTxnId = 123456, + echeck = echeck + }; litleBatchRequest.addEcheckRedeposit(echeckredeposit); - echeckRedeposit echeckredeposit2 = new echeckRedeposit(); - echeckredeposit2.litleTxnId = 123457; - echeckredeposit2.echeck = echeck2; + var echeckredeposit2 = new echeckRedeposit + { + litleTxnId = 123457, + echeck = echeck2 + }; litleBatchRequest.addEcheckRedeposit(echeckredeposit2); - echeckSale echeckSaleObj = new echeckSale(); - echeckSaleObj.amount = 123456; - echeckSaleObj.orderId = "12345"; - echeckSaleObj.orderSource = orderSourceType.ecommerce; - echeckSaleObj.echeck = echeck; - echeckSaleObj.billToAddress = billToAddress; + var echeckSaleObj = new echeckSale + { + amount = 123456, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeck = echeck, + billToAddress = billToAddress + }; litleBatchRequest.addEcheckSale(echeckSaleObj); - echeckSale echeckSaleObj2 = new echeckSale(); - echeckSaleObj2.amount = 123456; - echeckSaleObj2.orderId = "12346"; - echeckSaleObj2.orderSource = orderSourceType.ecommerce; - echeckSaleObj2.echeck = echeck2; - echeckSaleObj2.billToAddress = billToAddress2; + var echeckSaleObj2 = new echeckSale + { + amount = 123456, + orderId = "12346", + orderSource = orderSourceType.ecommerce, + echeck = echeck2, + billToAddress = billToAddress2 + }; litleBatchRequest.addEcheckSale(echeckSaleObj2); - echeckVerification echeckVerificationObject = new echeckVerification(); - echeckVerificationObject.amount = 123456; - echeckVerificationObject.orderId = "12345"; - echeckVerificationObject.orderSource = orderSourceType.ecommerce; - echeckVerificationObject.echeck = echeck; - echeckVerificationObject.billToAddress = billToAddress; + var echeckVerificationObject = new echeckVerification + { + amount = 123456, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeck = echeck, + billToAddress = billToAddress + }; litleBatchRequest.addEcheckVerification(echeckVerificationObject); - echeckVerification echeckVerificationObject2 = new echeckVerification(); - echeckVerificationObject2.amount = 123456; - echeckVerificationObject2.orderId = "12346"; - echeckVerificationObject2.orderSource = orderSourceType.ecommerce; - echeckVerificationObject2.echeck = echeck2; - echeckVerificationObject2.billToAddress = billToAddress2; + var echeckVerificationObject2 = new echeckVerification + { + amount = 123456, + orderId = "12346", + orderSource = orderSourceType.ecommerce, + echeck = echeck2, + billToAddress = billToAddress2 + }; litleBatchRequest.addEcheckVerification(echeckVerificationObject2); - forceCapture forcecapture = new forceCapture(); - forcecapture.amount = 106; - forcecapture.orderId = "12344"; - forcecapture.orderSource = orderSourceType.ecommerce; - forcecapture.card = card; + var forcecapture = new forceCapture + { + amount = 106, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + card = card + }; litleBatchRequest.addForceCapture(forcecapture); - forceCapture forcecapture2 = new forceCapture(); - forcecapture2.amount = 106; - forcecapture2.orderId = "12345"; - forcecapture2.orderSource = orderSourceType.ecommerce; - forcecapture2.card = card2; + var forcecapture2 = new forceCapture + { + amount = 106, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + card = card2 + }; litleBatchRequest.addForceCapture(forcecapture2); - sale saleObj = new sale(); - saleObj.amount = 106; - saleObj.litleTxnId = 123456; - saleObj.orderId = "12344"; - saleObj.orderSource = orderSourceType.ecommerce; - saleObj.card = card; + var saleObj = new sale + { + amount = 106, + litleTxnId = 123456, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + card = card + }; litleBatchRequest.addSale(saleObj); - sale saleObj2 = new sale(); - saleObj2.amount = 106; - saleObj2.litleTxnId = 123456; - saleObj2.orderId = "12345"; - saleObj2.orderSource = orderSourceType.ecommerce; - saleObj2.card = card2; + var saleObj2 = new sale + { + amount = 106, + litleTxnId = 123456, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + card = card2 + }; litleBatchRequest.addSale(saleObj2); - registerTokenRequestType registerTokenRequest = new registerTokenRequestType(); - registerTokenRequest.orderId = "12344"; - registerTokenRequest.accountNumber = "1233456789103801"; - registerTokenRequest.reportGroup = "Planets"; + var registerTokenRequest = new registerTokenRequestType + { + orderId = "12344", + accountNumber = "1233456789103801", + reportGroup = "Planets" + }; litleBatchRequest.addRegisterTokenRequest(registerTokenRequest); - registerTokenRequestType registerTokenRequest2 = new registerTokenRequestType(); - registerTokenRequest2.orderId = "12345"; - registerTokenRequest2.accountNumber = "1233456789103801"; - registerTokenRequest2.reportGroup = "Planets"; + var registerTokenRequest2 = new registerTokenRequestType + { + orderId = "12345", + accountNumber = "1233456789103801", + reportGroup = "Planets" + }; litleBatchRequest.addRegisterTokenRequest(registerTokenRequest2); - litleIC.addBatch(litleBatchRequest); + litleIc.addBatch(litleBatchRequest); - string batchName = litleIC.sendToLitle(); + var batchName = litleIc.sendToLitle(); - litleIC.blockAndWaitForResponse(batchName, 60*1000*5); + litleIc.blockAndWaitForResponse(batchName, 60*1000*5); try { - litleResponse litleResponse = litleIC.receiveFromLitle(batchName); + litleIc.receiveFromLitle(batchName); Assert.Fail("Fail to throw a connection exception"); } catch (LitleOnlineException e) @@ -1085,247 +1275,317 @@ public void InvalidCredientialsBatch() [Test] public void InvalidSftpCredientialsBatch() { - litleRequest litleISC = new litleRequest(invalidSftpConfig); + var litleIsc = new litleRequest(_invalidSftpConfig); - batchRequest litleBatchRequest = new batchRequest(); + var litleBatchRequest = new batchRequest(); + + var card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000001", + expDate = "1210" + }; - authorization authorization = new authorization(); - authorization.reportGroup = "Planets"; - authorization.orderId = "12344"; - authorization.amount = 106; - authorization.orderSource = orderSourceType.ecommerce; - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.VI; - card.number = "4100000000000001"; - card.expDate = "1210"; - authorization.card = card; //This needs to compile + var authorization = new authorization + { + reportGroup = "Planets", + orderId = "12344", + amount = 106, + orderSource = orderSourceType.ecommerce, + card = card + }; litleBatchRequest.addAuthorization(authorization); - authorization authorization2 = new authorization(); - authorization2.reportGroup = "Planets"; - authorization2.orderId = "12345"; - authorization2.amount = 106; - authorization2.orderSource = orderSourceType.ecommerce; - cardType card2 = new cardType(); - card2.type = methodOfPaymentTypeEnum.VI; - card2.number = "4242424242424242"; - card2.expDate = "1210"; - authorization2.card = card2; //This needs to compile + var card2 = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4242424242424242", + expDate = "1210" + }; + + var authorization2 = new authorization + { + reportGroup = "Planets", + orderId = "12345", + amount = 106, + orderSource = orderSourceType.ecommerce, + card = card2 + }; litleBatchRequest.addAuthorization(authorization2); - authReversal reversal = new authReversal(); - reversal.litleTxnId = 12345678000L; - reversal.amount = 106; - reversal.payPalNotes = "Notes"; + var reversal = new authReversal + { + litleTxnId = 12345678000L, + amount = 106, + payPalNotes = "Notes" + }; litleBatchRequest.addAuthReversal(reversal); - authReversal reversal2 = new authReversal(); - reversal2.litleTxnId = 12345678900L; - reversal2.amount = 106; - reversal2.payPalNotes = "Notes"; + var reversal2 = new authReversal + { + litleTxnId = 12345678900L, + amount = 106, + payPalNotes = "Notes" + }; litleBatchRequest.addAuthReversal(reversal2); - capture capture = new capture(); - capture.litleTxnId = 123456000; - capture.amount = 106; - capture.payPalNotes = "Notes"; + var capture = new capture + { + litleTxnId = 123456000, + amount = 106, + payPalNotes = "Notes" + }; litleBatchRequest.addCapture(capture); - capture capture2 = new capture(); - capture2.litleTxnId = 123456700; - capture2.amount = 106; - capture2.payPalNotes = "Notes"; + var capture2 = new capture + { + litleTxnId = 123456700, + amount = 106, + payPalNotes = "Notes" + }; - litleBatchRequest.addCapture(capture2); + var authInfo = new authInformation + { + authDate = new DateTime(2002, 10, 9), + authCode = "543216", + authAmount = 12345 + }; - captureGivenAuth capturegivenauth = new captureGivenAuth(); - capturegivenauth.amount = 106; - capturegivenauth.orderId = "12344"; - authInformation authInfo = new authInformation(); - DateTime authDate = new DateTime(2002, 10, 9); - authInfo.authDate = authDate; - authInfo.authCode = "543216"; - authInfo.authAmount = 12345; - capturegivenauth.authInformation = authInfo; - capturegivenauth.orderSource = orderSourceType.ecommerce; - capturegivenauth.card = card; + litleBatchRequest.addCapture(capture2); + var capturegivenauth = new captureGivenAuth + { + amount = 106, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + authInformation = authInfo, + card = card + }; + litleBatchRequest.addCaptureGivenAuth(capturegivenauth); - captureGivenAuth capturegivenauth2 = new captureGivenAuth(); - capturegivenauth2.amount = 106; - capturegivenauth2.orderId = "12344"; - authInformation authInfo2 = new authInformation(); - authDate = new DateTime(2003, 10, 9); - authInfo2.authDate = authDate; - authInfo2.authCode = "543216"; - authInfo2.authAmount = 12345; - capturegivenauth2.authInformation = authInfo; - capturegivenauth2.orderSource = orderSourceType.ecommerce; - capturegivenauth2.card = card2; + var authInfo2 = new authInformation + { + authDate = new DateTime(2003, 10, 9), + authCode = "543216", + authAmount = 12345 + }; + var capturegivenauth2 = new captureGivenAuth + { + amount = 106, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + authInformation = authInfo2, + card = card2 + }; + litleBatchRequest.addCaptureGivenAuth(capturegivenauth2); - credit creditObj = new credit(); - creditObj.amount = 106; - creditObj.orderId = "2111"; - creditObj.orderSource = orderSourceType.ecommerce; - creditObj.card = card; + var creditObj = new credit + { + amount = 106, + orderId = "2111", + orderSource = orderSourceType.ecommerce, + card = card + }; litleBatchRequest.addCredit(creditObj); - credit creditObj2 = new credit(); - creditObj2.amount = 106; - creditObj2.orderId = "2111"; - creditObj2.orderSource = orderSourceType.ecommerce; - creditObj2.card = card2; + var creditObj2 = new credit + { + amount = 106, + orderId = "2111", + orderSource = orderSourceType.ecommerce, + card = card2 + }; litleBatchRequest.addCredit(creditObj2); - echeckCredit echeckcredit = new echeckCredit(); - echeckcredit.amount = 12L; - echeckcredit.orderId = "12345"; - echeckcredit.orderSource = orderSourceType.ecommerce; - echeckType echeck = new echeckType(); - echeck.accType = echeckAccountTypeEnum.Checking; - echeck.accNum = "1099999903"; - echeck.routingNum = "011201995"; - echeck.checkNum = "123455"; - echeckcredit.echeck = echeck; - contact billToAddress = new contact(); - billToAddress.name = "Bob"; - billToAddress.city = "Lowell"; - billToAddress.state = "MA"; - billToAddress.email = "litle.com"; - echeckcredit.billToAddress = billToAddress; + var echeck = new echeckType + { + accType = echeckAccountTypeEnum.Checking, + accNum = "1099999903", + routingNum = "011201995", + checkNum = "123455" + }; + + var billToAddress = new contact + { + name = "Bob", + city = "Lowell", + state = "MA", + email = "litle.com" + }; + + var echeckcredit = new echeckCredit + { + amount = 12L, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeck = echeck, + billToAddress = billToAddress + }; litleBatchRequest.addEcheckCredit(echeckcredit); - echeckCredit echeckcredit2 = new echeckCredit(); - echeckcredit2.amount = 12L; - echeckcredit2.orderId = "12346"; - echeckcredit2.orderSource = orderSourceType.ecommerce; - echeckType echeck2 = new echeckType(); - echeck2.accType = echeckAccountTypeEnum.Checking; - echeck2.accNum = "1099999903"; - echeck2.routingNum = "011201995"; - echeck2.checkNum = "123456"; - echeckcredit2.echeck = echeck2; - contact billToAddress2 = new contact(); - billToAddress2.name = "Mike"; - billToAddress2.city = "Lowell"; - billToAddress2.state = "MA"; - billToAddress2.email = "litle.com"; - echeckcredit2.billToAddress = billToAddress2; + var echeck2 = new echeckType + { + accType = echeckAccountTypeEnum.Checking, + accNum = "1099999903", + routingNum = "011201995", + checkNum = "123456" + }; + + var billToAddress2 = new contact + { + name = "Mike", + city = "Lowell", + state = "MA", + email = "litle.com" + }; + var echeckcredit2 = new echeckCredit + { + amount = 12L, + orderId = "12346", + orderSource = orderSourceType.ecommerce, + echeck = echeck2, + billToAddress = billToAddress2 + }; + litleBatchRequest.addEcheckCredit(echeckcredit2); - echeckRedeposit echeckredeposit = new echeckRedeposit(); - echeckredeposit.litleTxnId = 123456; - echeckredeposit.echeck = echeck; + var echeckredeposit = new echeckRedeposit + { + litleTxnId = 123456, + echeck = echeck + }; litleBatchRequest.addEcheckRedeposit(echeckredeposit); - echeckRedeposit echeckredeposit2 = new echeckRedeposit(); - echeckredeposit2.litleTxnId = 123457; - echeckredeposit2.echeck = echeck2; + var echeckredeposit2 = new echeckRedeposit + { + litleTxnId = 123457, + echeck = echeck2 + }; litleBatchRequest.addEcheckRedeposit(echeckredeposit2); - echeckSale echeckSaleObj = new echeckSale(); - echeckSaleObj.amount = 123456; - echeckSaleObj.orderId = "12345"; - echeckSaleObj.orderSource = orderSourceType.ecommerce; - echeckSaleObj.echeck = echeck; - echeckSaleObj.billToAddress = billToAddress; + var echeckSaleObj = new echeckSale + { + amount = 123456, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeck = echeck, + billToAddress = billToAddress + }; litleBatchRequest.addEcheckSale(echeckSaleObj); - echeckSale echeckSaleObj2 = new echeckSale(); - echeckSaleObj2.amount = 123456; - echeckSaleObj2.orderId = "12346"; - echeckSaleObj2.orderSource = orderSourceType.ecommerce; - echeckSaleObj2.echeck = echeck2; - echeckSaleObj2.billToAddress = billToAddress2; + var echeckSaleObj2 = new echeckSale + { + amount = 123456, + orderId = "12346", + orderSource = orderSourceType.ecommerce, + echeck = echeck2, + billToAddress = billToAddress2 + }; litleBatchRequest.addEcheckSale(echeckSaleObj2); - echeckVerification echeckVerificationObject = new echeckVerification(); - echeckVerificationObject.amount = 123456; - echeckVerificationObject.orderId = "12345"; - echeckVerificationObject.orderSource = orderSourceType.ecommerce; - echeckVerificationObject.echeck = echeck; - echeckVerificationObject.billToAddress = billToAddress; + var echeckVerificationObject = new echeckVerification + { + amount = 123456, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeck = echeck, + billToAddress = billToAddress + }; litleBatchRequest.addEcheckVerification(echeckVerificationObject); - echeckVerification echeckVerificationObject2 = new echeckVerification(); - echeckVerificationObject2.amount = 123456; - echeckVerificationObject2.orderId = "12346"; - echeckVerificationObject2.orderSource = orderSourceType.ecommerce; - echeckVerificationObject2.echeck = echeck2; - echeckVerificationObject2.billToAddress = billToAddress2; + var echeckVerificationObject2 = new echeckVerification + { + amount = 123456, + orderId = "12346", + orderSource = orderSourceType.ecommerce, + echeck = echeck2, + billToAddress = billToAddress2 + }; litleBatchRequest.addEcheckVerification(echeckVerificationObject2); - forceCapture forcecapture = new forceCapture(); - forcecapture.amount = 106; - forcecapture.orderId = "12344"; - forcecapture.orderSource = orderSourceType.ecommerce; - forcecapture.card = card; + var forcecapture = new forceCapture + { + amount = 106, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + card = card + }; litleBatchRequest.addForceCapture(forcecapture); - forceCapture forcecapture2 = new forceCapture(); - forcecapture2.amount = 106; - forcecapture2.orderId = "12345"; - forcecapture2.orderSource = orderSourceType.ecommerce; - forcecapture2.card = card2; + var forcecapture2 = new forceCapture + { + amount = 106, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + card = card2 + }; litleBatchRequest.addForceCapture(forcecapture2); - sale saleObj = new sale(); - saleObj.amount = 106; - saleObj.litleTxnId = 123456; - saleObj.orderId = "12344"; - saleObj.orderSource = orderSourceType.ecommerce; - saleObj.card = card; + var saleObj = new sale + { + amount = 106, + litleTxnId = 123456, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + card = card + }; litleBatchRequest.addSale(saleObj); - sale saleObj2 = new sale(); - saleObj2.amount = 106; - saleObj2.litleTxnId = 123456; - saleObj2.orderId = "12345"; - saleObj2.orderSource = orderSourceType.ecommerce; - saleObj2.card = card2; + var saleObj2 = new sale + { + amount = 106, + litleTxnId = 123456, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + card = card2 + }; litleBatchRequest.addSale(saleObj2); - registerTokenRequestType registerTokenRequest = new registerTokenRequestType(); - registerTokenRequest.orderId = "12344"; - registerTokenRequest.accountNumber = "1233456789103801"; - registerTokenRequest.reportGroup = "Planets"; + var registerTokenRequest = new registerTokenRequestType + { + orderId = "12344", + accountNumber = "1233456789103801", + reportGroup = "Planets" + }; litleBatchRequest.addRegisterTokenRequest(registerTokenRequest); - registerTokenRequestType registerTokenRequest2 = new registerTokenRequestType(); - registerTokenRequest2.orderId = "12345"; - registerTokenRequest2.accountNumber = "1233456789103801"; - registerTokenRequest2.reportGroup = "Planets"; + var registerTokenRequest2 = new registerTokenRequestType + { + orderId = "12345", + accountNumber = "1233456789103801", + reportGroup = "Planets" + }; litleBatchRequest.addRegisterTokenRequest(registerTokenRequest2); - litleISC.addBatch(litleBatchRequest); + litleIsc.addBatch(litleBatchRequest); try { - string batchName = litleISC.sendToLitle(); + litleIsc.sendToLitle(); Assert.Fail("Fail to throw a connection exception"); } catch (LitleOnlineException e) @@ -1337,37 +1597,42 @@ public void InvalidSftpCredientialsBatch() [Test] public void SimpleBatchWithSpecialCharacters() { - batchRequest litleBatchRequest = new batchRequest(); - - authorization authorization = new authorization(); - authorization.reportGroup = ""; - authorization.orderId = "12344&'\""; - authorization.amount = 106; - authorization.orderSource = orderSourceType.ecommerce; - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.VI; - card.number = "4100000000000001"; - card.expDate = "1210"; - authorization.card = card; + var litleBatchRequest = new batchRequest(); + + var card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000001", + expDate = "1210" + }; + var authorization = new authorization + { + reportGroup = "", + orderId = "12344&'\"", + amount = 106, + orderSource = orderSourceType.ecommerce, + card = card + }; + litleBatchRequest.addAuthorization(authorization); - litle.addBatch(litleBatchRequest); + _litle.addBatch(litleBatchRequest); - string batchName = litle.sendToLitle(); + var batchName = _litle.sendToLitle(); - litle.blockAndWaitForResponse(batchName, estimatedResponseTime(2 * 2, 10 * 2)); + _litle.blockAndWaitForResponse(batchName, EstimatedResponseTime(2 * 2, 10 * 2)); - litleResponse litleResponse = litle.receiveFromLitle(batchName); + var litleResponse = _litle.receiveFromLitle(batchName); Assert.NotNull(litleResponse); Assert.AreEqual("0", litleResponse.response); Assert.AreEqual("Valid Format", litleResponse.message); - batchResponse litleBatchResponse = litleResponse.nextBatchResponse(); + var litleBatchResponse = litleResponse.nextBatchResponse(); while (litleBatchResponse != null) { - authorizationResponse authorizationResponse = litleBatchResponse.nextAuthorizationResponse(); + var authorizationResponse = litleBatchResponse.nextAuthorizationResponse(); while (authorizationResponse != null) { Assert.AreEqual("000", authorizationResponse.response); @@ -1379,7 +1644,7 @@ public void SimpleBatchWithSpecialCharacters() } } - private int estimatedResponseTime(int numAuthsAndSales, int numRest) + private static int EstimatedResponseTime(int numAuthsAndSales, int numRest) { return (int)(5 * 60 * 1000 + 2.5 * 1000 + numAuthsAndSales * (1 / 5) * 1000 + numRest * (1 / 50) * 1000) * 5; } diff --git a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestBatchStream.cs b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestBatchStream.cs index 4ab3179b..204e1989 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestBatchStream.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestBatchStream.cs @@ -8,7 +8,7 @@ namespace Litle.Sdk.Test.Functional { [TestFixture] - class TestBatchStream + internal class TestBatchStream { private litleRequest litle; private Dictionary invalidConfig; diff --git a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestCapture.cs b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestCapture.cs index e18425b1..a1a73081 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestCapture.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestCapture.cs @@ -1,87 +1,134 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; using NUnit.Framework; -using Litle.Sdk; namespace Litle.Sdk.Test.Functional { [TestFixture] - class TestCapture + internal class TestCapture { - private LitleOnline litle; + private LitleOnline _litle; [TestFixtureSetUp] public void SetUpLitle() { - Dictionary config = new Dictionary(); - config.Add("url", "https://www.testlitle.com/sandbox/communicator/online"); - config.Add("reportGroup", "Default Report Group"); - config.Add("username", "DOTNET"); - config.Add("version", "8.13"); - config.Add("timeout", "65"); - config.Add("merchantId", "101"); - config.Add("password", "TESTCASE"); - config.Add("printxml", "true"); - config.Add("proxyHost", Properties.Settings.Default.proxyHost); - config.Add("proxyPort", Properties.Settings.Default.proxyPort); - config.Add("logFile", Properties.Settings.Default.logFile); - config.Add("neuterAccountNums", "true"); - litle = new LitleOnline(config); + var config = new Dictionary + { + {"url", "https://www.testlitle.com/sandbox/communicator/online"}, + {"reportGroup", "Default Report Group"}, + {"username", "DOTNET"}, + {"version", "8.13"}, + {"timeout", "5000"}, + {"merchantId", "101"}, + {"password", "TESTCASE"}, + {"printxml", "true"}, + {"proxyHost", Properties.Settings.Default.proxyHost}, + {"proxyPort", Properties.Settings.Default.proxyPort}, + {"logFile", Properties.Settings.Default.logFile}, + {"neuterAccountNums", "true"} + }; + _litle = new LitleOnline(config); } [Test] public void SimpleCapture() { - capture capture = new capture(); - capture.litleTxnId = 123456000; - capture.amount = 106; - capture.payPalNotes = "Notes"; + var capture = new capture + { + litleTxnId = 123456000, + amount = 106, + payPalNotes = "Notes" + }; - captureResponse response = litle.Capture(capture); + var response = _litle.Capture(capture); Assert.AreEqual("Approved", response.message); } [Test] - public void simpleCaptureWithPartial() + public void SimpleCaptureWithPartial() { - capture capture = new capture(); - capture.litleTxnId = 123456000; - capture.amount = 106; - capture.partial = true; - capture.payPalNotes = "Notes"; + var capture = new capture + { + litleTxnId = 123456000, + amount = 106, + partial = true, + payPalNotes = "Notes" + }; - captureResponse response = litle.Capture(capture); + var response = _litle.Capture(capture); Assert.AreEqual("Approved", response.message); } [Test] - public void complexCapture() + public void ComplexCapture() { - capture capture = new capture(); - capture.litleTxnId = 123456000; - capture.amount = 106; - capture.payPalNotes = "Notes"; - enhancedData enhanceddata = new enhancedData(); - enhanceddata.customerReference = "Litle"; - enhanceddata.salesTax = 50; - enhanceddata.deliveryType = enhancedDataDeliveryType.TBD; - capture.enhancedData = enhanceddata; - capture.payPalOrderComplete = true; - captureResponse response = litle.Capture(capture); + var capture = new capture + { + litleTxnId = 123456000, + amount = 106, + payPalNotes = "Notes", + payPalOrderComplete = true, + enhancedData = new enhancedData + { + customerReference = "Litle", + salesTax = 50, + deliveryType = enhancedDataDeliveryType.TBD + } + }; + + var response = _litle.Capture(capture); Assert.AreEqual("Approved", response.message); } [Test] public void SimpleCaptureWithSpecial() { - capture capture = new capture(); - capture.litleTxnId = 123456000; - capture.amount = 106; - capture.payPalNotes = "<'&\">"; + var capture = new capture + { + litleTxnId = 123456000, + amount = 106, + payPalNotes = "<'&\">" + }; - captureResponse response = litle.Capture(capture); + var response = _litle.Capture(capture); Assert.AreEqual("Approved", response.message); } + + [Test] + public void SimpleCapture_withPin() + { + var capture = new capture + { + litleTxnId = 123456000, + amount = 106, + payPalNotes = "Notes", + pin = "1234" + }; + + var response = _litle.Capture(capture); + Assert.AreEqual("Approved", response.message); + } + + [Test] + public void SimpleCapture_withPin_negative() + { + var capture = new capture + { + litleTxnId = 123456000, + amount = 106, + payPalNotes = "Notes", + pin = "1" + }; + + try + { + _litle.Capture(capture); + Assert.Fail("Exception expected!"); + } + catch (LitleOnlineException e) + { + Assert.True(e.Message.StartsWith("Error validating xml data against the")); + } + + } } } diff --git a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestCaptureGivenAuth.cs b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestCaptureGivenAuth.cs index 53abb239..82e2e7a6 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestCaptureGivenAuth.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestCaptureGivenAuth.cs @@ -1,203 +1,261 @@ using System; using System.Collections.Generic; -using System.Text; using NUnit.Framework; -using Litle.Sdk; namespace Litle.Sdk.Test.Functional { [TestFixture] - class TestCaptureGivenAuth + internal class TestCaptureGivenAuth { - private LitleOnline litle; + private LitleOnline _litle; [TestFixtureSetUp] - public void setUp() + public void SetUp() { - Dictionary config = new Dictionary(); - config.Add("url", "https://www.testlitle.com/sandbox/communicator/online"); - config.Add("reportGroup", "Default Report Group"); - config.Add("username", "DOTNET"); - config.Add("version", "8.13"); - config.Add("timeout", "65"); - config.Add("merchantId", "101"); - config.Add("password", "TESTCASE"); - config.Add("printxml", "true"); - config.Add("proxyHost", Properties.Settings.Default.proxyHost); - config.Add("proxyPort", Properties.Settings.Default.proxyPort); - config.Add("logFile", Properties.Settings.Default.logFile); - config.Add("neuterAccountNums", "true"); - litle = new LitleOnline(config); + var config = new Dictionary + { + {"url", "https://www.testlitle.com/sandbox/communicator/online"}, + {"reportGroup", "Default Report Group"}, + {"username", "DOTNET"}, + {"version", "8.13"}, + {"timeout", "5000"}, + {"merchantId", "101"}, + {"password", "TESTCASE"}, + {"printxml", "true"}, + {"proxyHost", Properties.Settings.Default.proxyHost}, + {"proxyPort", Properties.Settings.Default.proxyPort}, + {"logFile", Properties.Settings.Default.logFile}, + {"neuterAccountNums", "true"} + }; + _litle = new LitleOnline(config); } [Test] - public void simpleCaptureGivenAuthWithCard() { - captureGivenAuth capturegivenauth = new captureGivenAuth(); - capturegivenauth.amount = 106; - capturegivenauth.orderId = "12344"; - authInformation authInfo = new authInformation(); - DateTime authDate = new DateTime(2002, 10, 9); - authInfo.authDate = authDate; - authInfo.authCode = "543216"; - authInfo.authAmount = 12345; - capturegivenauth.authInformation = authInfo; - capturegivenauth.orderSource = orderSourceType.ecommerce; - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.VI; - card.number = "4100000000000000"; - card.expDate = "1210"; - capturegivenauth.card = card; - captureGivenAuthResponse response = litle.CaptureGivenAuth(capturegivenauth); + public void SimpleCaptureGivenAuthWithCard() { + var capturegivenauth = new captureGivenAuth + { + amount = 106, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000000", + expDate = "1210" + }, + authInformation = new authInformation + { + authDate = new DateTime(2002, 10, 9), + authCode = "543216", + authAmount = 12345 + } + }; + + var response = _litle.CaptureGivenAuth(capturegivenauth); Assert.AreEqual("Approved", response.message); } [Test] - public void simpleCaptureGivenAuthWithMpos() + public void SimpleCaptureGivenAuthWithMpos() { - captureGivenAuth capturegivenauth = new captureGivenAuth(); - capturegivenauth.amount = 500; - capturegivenauth.orderId = "12344"; - authInformation authInfo = new authInformation(); - DateTime authDate = new DateTime(2002, 10, 9); - authInfo.authDate = authDate; - authInfo.authCode = "543216"; - authInfo.authAmount = 12345; - capturegivenauth.authInformation = authInfo; - capturegivenauth.orderSource = orderSourceType.ecommerce; - mposType mpos = new mposType(); - mpos.ksn = "77853211300008E00016"; - mpos.encryptedTrack = "CASE1E185EADD6AFE78C9A214B21313DCD836FDD555FBE3A6C48D141FE80AB9172B963265AFF72111895FE415DEDA162CE8CB7AC4D91EDB611A2AB756AA9CB1A000000000000000000000000000000005A7AAF5E8885A9DB88ECD2430C497003F2646619A2382FFF205767492306AC804E8E64E8EA6981DD"; - mpos.formatId = "30"; - mpos.track1Status = 0; - mpos.track2Status = 0; - capturegivenauth.mpos = mpos; - captureGivenAuthResponse response = litle.CaptureGivenAuth(capturegivenauth); + var capturegivenauth = new captureGivenAuth + { + amount = 500, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + authInformation = new authInformation + { + authDate = new DateTime(2002, 10, 9), + authCode = "543216", + authAmount = 12345 + }, + mpos = new mposType + { + ksn = "77853211300008E00016", + encryptedTrack = + "CASE1E185EADD6AFE78C9A214B21313DCD836FDD555FBE3A6C48D141FE80AB9172B963265AFF72111895FE415DEDA162CE8CB7AC4D91EDB611A2AB756AA9CB1A000000000000000000000000000000005A7AAF5E8885A9DB88ECD2430C497003F2646619A2382FFF205767492306AC804E8E64E8EA6981DD", + formatId = "30", + track1Status = 0, + track2Status = 0 + } + }; + + var response = _litle.CaptureGivenAuth(capturegivenauth); Assert.AreEqual("Approved", response.message); } [Test] - public void simpleCaptureGivenAuthWithToken() { - captureGivenAuth capturegivenauth = new captureGivenAuth(); - capturegivenauth.amount = 106; - capturegivenauth.orderId = "12344"; - authInformation authInfo = new authInformation(); - DateTime authDate = new DateTime(2002, 10, 9); - authInfo.authDate = authDate; - authInfo.authCode = "543216"; - authInfo.authAmount = 12345; - capturegivenauth.authInformation = authInfo; - capturegivenauth.orderSource = orderSourceType.ecommerce; - cardTokenType cardtoken = new cardTokenType(); - cardtoken.litleToken = "123456789101112"; - cardtoken.expDate ="1210"; - cardtoken.cardValidationNum = "555"; - cardtoken.type = methodOfPaymentTypeEnum.VI; - capturegivenauth.token = cardtoken; - captureGivenAuthResponse response = litle.CaptureGivenAuth(capturegivenauth); + public void SimpleCaptureGivenAuthWithToken() { + var capturegivenauth = new captureGivenAuth + { + amount = 106, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + token = new cardTokenType + { + litleToken = "123456789101112", + expDate = "1210", + cardValidationNum = "555", + type = methodOfPaymentTypeEnum.VI + }, + authInformation = new authInformation + { + authDate = new DateTime(2002, 10, 9), + authCode = "543216", + authAmount = 12345 + } + }; + + var response = _litle.CaptureGivenAuth(capturegivenauth); Assert.AreEqual("Approved", response.message); } [Test] - public void complexCaptureGivenAuth() { - captureGivenAuth capturegivenauth = new captureGivenAuth(); - capturegivenauth.amount = 106; - capturegivenauth.orderId = "12344"; - authInformation authInfo = new authInformation(); - DateTime authDate = new DateTime(2002, 10, 9); - authInfo.authDate = authDate; - authInfo.authCode = "543216"; - authInfo.authAmount = 12345; - capturegivenauth.authInformation = authInfo; - contact contact = new contact(); - contact.name = "Bob"; - contact.city = "lowell"; - contact.state = "MA"; - contact.email ="litle.com"; - capturegivenauth.billToAddress = contact; - processingInstructions processinginstructions = new processingInstructions(); - processinginstructions.bypassVelocityCheck = true; - capturegivenauth.processingInstructions = processinginstructions; - capturegivenauth.orderSource = orderSourceType.ecommerce; - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.VI; - card.number = "4100000000000000"; - card.expDate = "1210"; - capturegivenauth.card = card; - captureGivenAuthResponse response = litle.CaptureGivenAuth(capturegivenauth); + public void ComplexCaptureGivenAuth() { + var capturegivenauth = new captureGivenAuth + { + amount = 106, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000000", + expDate = "1210" + }, + authInformation = new authInformation + { + authDate = new DateTime(2002, 10, 9), + authCode = "543216", + authAmount = 12345 + }, + billToAddress = new contact + { + name = "Bob", + city = "lowell", + state = "MA", + email = "litle.com" + }, + processingInstructions = new processingInstructions { bypassVelocityCheck = true } + }; + + var response = _litle.CaptureGivenAuth(capturegivenauth); Assert.AreEqual("Approved", response.message); } [Test] - public void authInfo() { - captureGivenAuth capturegivenauth = new captureGivenAuth(); - capturegivenauth.amount = 106; - capturegivenauth.orderId = "12344"; - authInformation authInfo = new authInformation(); - DateTime authDate = new DateTime(2002, 10, 9); - authInfo.authDate = authDate; - authInfo.authCode = "543216"; - authInfo.authAmount = 12345; - fraudResult fraudresult = new fraudResult(); - fraudresult.avsResult = "12"; - fraudresult.cardValidationResult = "123"; - fraudresult.authenticationResult = "1"; - fraudresult.advancedAVSResult = "123"; - authInfo.fraudResult = fraudresult; - capturegivenauth.authInformation = authInfo; - capturegivenauth.orderSource = orderSourceType.ecommerce; - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.VI; - card.number = "4100000000000000"; - card.expDate = "1210"; - capturegivenauth.card=card; - captureGivenAuthResponse response = litle.CaptureGivenAuth(capturegivenauth); + public void AuthInfo() { + var capturegivenauth = new captureGivenAuth + { + amount = 106, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000000", + expDate = "1210" + }, + authInformation = new authInformation + { + authDate = new DateTime(2002, 10, 9), + authCode = "543216", + authAmount = 12345, + fraudResult = new fraudResult + { + avsResult = "12", + cardValidationResult = "123", + authenticationResult = "1", + advancedAVSResult = "123" + } + } + }; + + var response = _litle.CaptureGivenAuth(capturegivenauth); + Assert.AreEqual("Approved", response.message); + } + + [Test] + public void SimpleCaptureGivenAuthWithTokenAndSpecialCharacters() + { + var capturegivenauth = new captureGivenAuth + { + amount = 106, + orderId = "<'&\">", + orderSource = orderSourceType.ecommerce, + token = new cardTokenType + { + litleToken = "123456789101112", + expDate = "1210", + cardValidationNum = "555", + type = methodOfPaymentTypeEnum.VI + }, + authInformation = new authInformation + { + authDate = new DateTime(2002, 10, 9), + authCode = "543216", + authAmount = 12345 + } + }; + + var response = _litle.CaptureGivenAuth(capturegivenauth); Assert.AreEqual("Approved", response.message); } [Test] - public void simpleCaptureGivenAuthWithTokenAndSpecialCharacters() + public void SimpleCaptureGivenAuthWithSecondaryAmount() { - captureGivenAuth capturegivenauth = new captureGivenAuth(); - capturegivenauth.amount = 106; - capturegivenauth.orderId = "<'&\">"; - authInformation authInfo = new authInformation(); - DateTime authDate = new DateTime(2002, 10, 9); - authInfo.authDate = authDate; - authInfo.authCode = "543216"; - authInfo.authAmount = 12345; - capturegivenauth.authInformation = authInfo; - capturegivenauth.orderSource = orderSourceType.ecommerce; - cardTokenType cardtoken = new cardTokenType(); - cardtoken.litleToken = "123456789101112"; - cardtoken.expDate = "1210"; - cardtoken.cardValidationNum = "555"; - cardtoken.type = methodOfPaymentTypeEnum.VI; - capturegivenauth.token = cardtoken; - captureGivenAuthResponse response = litle.CaptureGivenAuth(capturegivenauth); + var capturegivenauth = new captureGivenAuth + { + amount = 106, + secondaryAmount = 50, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + authInformation = new authInformation + { + authDate = new DateTime(2002, 10, 9), + authCode = "543216", + authAmount = 12345 + }, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000000", + expDate = "1210" + } + }; + + var response = _litle.CaptureGivenAuth(capturegivenauth); Assert.AreEqual("Approved", response.message); } [Test] - public void simpleCaptureGivenAuthWithSecondaryAmount() + public void SimpleCaptureGivenAuthWithprocessingTypeOrigNetworkTxnIdAndOrigTxnAmount() { - captureGivenAuth capturegivenauth = new captureGivenAuth(); - capturegivenauth.amount = 106; - capturegivenauth.secondaryAmount = 50; - capturegivenauth.orderId = "12344"; - authInformation authInfo = new authInformation(); - DateTime authDate = new DateTime(2002, 10, 9); - authInfo.authDate = authDate; - authInfo.authCode = "543216"; - authInfo.authAmount = 12345; - capturegivenauth.authInformation = authInfo; - capturegivenauth.orderSource = orderSourceType.ecommerce; - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.VI; - card.number = "4100000000000000"; - card.expDate = "1210"; - capturegivenauth.card = card; - captureGivenAuthResponse response = litle.CaptureGivenAuth(capturegivenauth); + var capturegivenauth = new captureGivenAuth + { + amount = 106, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000000", + expDate = "1210" + }, + authInformation = new authInformation + { + authDate = new DateTime(2002, 10, 9), + authCode = "543216", + authAmount = 12345 + }, + processingType = processingType.initialRecurring, + originalTransactionAmount = 42, + originalNetworkTransactionId = "12345678901234567890" + }; + + var response = _litle.CaptureGivenAuth(capturegivenauth); Assert.AreEqual("Approved", response.message); } } diff --git a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestCredit.cs b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestCredit.cs index 5bb111a3..664abdb4 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestCredit.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestCredit.cs @@ -1,147 +1,173 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; using NUnit.Framework; -using Litle.Sdk; namespace Litle.Sdk.Test.Functional { [TestFixture] - class TestCredit + internal class TestCredit { - private LitleOnline litle; + private LitleOnline _litle; [TestFixtureSetUp] - public void setUp() + public void SetUp() { - Dictionary config = new Dictionary(); - config.Add("url", "https://www.testlitle.com/sandbox/communicator/online"); - config.Add("reportGroup", "Default Report Group"); - config.Add("username", "DOTNET"); - config.Add("version", "8.13"); - config.Add("timeout", "65"); - config.Add("merchantId", "101"); - config.Add("password", "TESTCASE"); - config.Add("printxml", "true"); - config.Add("proxyHost", Properties.Settings.Default.proxyHost); - config.Add("proxyPort", Properties.Settings.Default.proxyPort); - config.Add("logFile", Properties.Settings.Default.logFile); - config.Add("neuterAccountNums", "true"); - litle = new LitleOnline(config); + var config = new Dictionary + { + {"url", "https://www.testlitle.com/sandbox/communicator/online"}, + {"reportGroup", "Default Report Group"}, + {"username", "DOTNET"}, + {"version", "9.12"}, + {"timeout", "5000"}, + {"merchantId", "101"}, + {"password", "TESTCASE"}, + {"printxml", "true"}, + {"proxyHost", Properties.Settings.Default.proxyHost}, + {"proxyPort", Properties.Settings.Default.proxyPort}, + {"logFile", Properties.Settings.Default.logFile}, + {"neuterAccountNums", "true"} + }; + _litle = new LitleOnline(config); } [Test] public void SimpleCreditWithCard() { - credit creditObj = new credit(); - creditObj.amount = 106; - creditObj.orderId = "2111"; - creditObj.orderSource = orderSourceType.ecommerce; - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.VI; - card.number = "4100000000000001"; - card.expDate = "1210"; - - creditObj.card = card; - - creditResponse response = litle.Credit(creditObj); + var creditObj = new credit + { + amount = 106, + orderId = "2111", + orderSource = orderSourceType.ecommerce, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000001", + expDate = "1210" + } + }; + + var response = _litle.Credit(creditObj); Assert.AreEqual("Approved", response.message); } [Test] public void SimpleCreditWithMpos() { - credit creditObj = new credit(); - creditObj.amount = 106; - creditObj.orderId = "2111"; - creditObj.orderSource = orderSourceType.ecommerce; - mposType mpos = new mposType(); - mpos.ksn = "77853211300008E00016"; - mpos.encryptedTrack = "CASE1E185EADD6AFE78C9A214B21313DCD836FDD555FBE3A6C48D141FE80AB9172B963265AFF72111895FE415DEDA162CE8CB7AC4D91EDB611A2AB756AA9CB1A000000000000000000000000000000005A7AAF5E8885A9DB88ECD2430C497003F2646619A2382FFF205767492306AC804E8E64E8EA6981DD"; - mpos.formatId = "30"; - mpos.track1Status = 0; - mpos.track2Status = 0; - creditObj.mpos = mpos; - - creditResponse response = litle.Credit(creditObj); + var creditObj = new credit + { + amount = 106, + orderId = "2111", + orderSource = orderSourceType.ecommerce, + mpos = new mposType + { + ksn = "77853211300008E00016", + encryptedTrack = + "CASE1E185EADD6AFE78C9A214B21313DCD836FDD555FBE3A6C48D141FE80AB9172B963265AFF72111895FE415DEDA162CE8CB7AC4D91EDB611A2AB756AA9CB1A000000000000000000000000000000005A7AAF5E8885A9DB88ECD2430C497003F2646619A2382FFF205767492306AC804E8E64E8EA6981DD", + formatId = "30", + track1Status = 0, + track2Status = 0 + } + }; + + var response = _litle.Credit(creditObj); Assert.AreEqual("Approved", response.message); } [Test] public void SimpleCreditWithPaypal() { - credit creditObj = new credit(); - creditObj.amount = 106; - creditObj.orderId = "123456"; - creditObj.orderSource = orderSourceType.ecommerce; - payPal payPalObj = new payPal(); - payPalObj.payerId = "1234"; - - creditObj.paypal = payPalObj; - - creditResponse response = litle.Credit(creditObj); + var creditObj = new credit + { + amount = 106, + orderId = "123456", + orderSource = orderSourceType.ecommerce, + paypal = new payPal { payerId = "1234" } + }; + + var response = _litle.Credit(creditObj); Assert.AreEqual("Approved", response.message); } [Test] public void PaypalNotes() { - credit creditObj = new credit(); - creditObj.amount = 106; - creditObj.orderId = "123456"; - creditObj.payPalNotes = "Hello"; - creditObj.orderSource = orderSourceType.ecommerce; - - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.VI; - card.number = "4100000000000001"; - card.expDate = "1210"; - - creditObj.card = card; - - creditResponse response = litle.Credit(creditObj); + var creditObj = new credit + { + amount = 106, + orderId = "123456", + payPalNotes = "Hello", + orderSource = orderSourceType.ecommerce, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000001", + expDate = "1210" + } + }; + + var response = _litle.Credit(creditObj); Assert.AreEqual("Approved", response.message); } [Test] public void ProcessingInstructionAndAmexData() { - credit creditObj = new credit(); - creditObj.amount = 2000; - creditObj.orderId = "12344"; - creditObj.orderSource = orderSourceType.ecommerce; - - processingInstructions processingInstructionsObj = new processingInstructions(); - processingInstructionsObj.bypassVelocityCheck = true; - - creditObj.processingInstructions = processingInstructionsObj; + var creditObj = new credit + { + amount = 2000, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + processingInstructions = new processingInstructions { bypassVelocityCheck = true }, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000001", + expDate = "1210" + } + }; - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.VI; - card.number = "4100000000000001"; - card.expDate = "1210"; - - creditObj.card = card; - - creditResponse response = litle.Credit(creditObj); + var response = _litle.Credit(creditObj); Assert.AreEqual("Approved", response.message); } [Test] public void SimpleCreditWithCardAndSpecialCharacters() { - credit creditObj = new credit(); - creditObj.amount = 106; - creditObj.orderId = "<&'>"; - creditObj.orderSource = orderSourceType.ecommerce; - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.VI; - card.number = "4100000<>0000001"; - card.expDate = "1210"; - - creditObj.card = card; + var creditObj = new credit + { + amount = 106, + orderId = "<&'>", + orderSource = orderSourceType.ecommerce, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000<>0000001", + expDate = "1210" + } + }; + + var response = _litle.Credit(creditObj); + Assert.AreEqual("Approved", response.message); + } - creditResponse response = litle.Credit(creditObj); + [Test] + public void SimpleCreditWithCardAndPin() + { + var creditObj = new credit + { + litleTxnId = 3, + amount = 106, + orderId = "2111", + orderSource = orderSourceType.ecommerce, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000001", + expDate = "1210" + }, + pin = "9876" + }; + + var response = _litle.Credit(creditObj); Assert.AreEqual("Approved", response.message); } } diff --git a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestEcheckCredit.cs b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestEcheckCredit.cs index f4f7271e..85c9cbe5 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestEcheckCredit.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestEcheckCredit.cs @@ -1,40 +1,54 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; using NUnit.Framework; -using Litle.Sdk; namespace Litle.Sdk.Test.Functional { [TestFixture] - class TestEcheckCredit + internal class TestEcheckCredit { - private LitleOnline litle; + private LitleOnline _litle; [TestFixtureSetUp] - public void beforeClass() + public void SetUp() { - litle = new LitleOnline(); + var config = new Dictionary + { + {"url", "https://www.testlitle.com/sandbox/communicator/online"}, + {"reportGroup", "Default Report Group"}, + {"username", "DOTNET"}, + {"version", "8.13"}, + {"timeout", "5000"}, + {"merchantId", "101"}, + {"password", "TESTCASE"}, + {"printxml", "true"}, + {"proxyHost", Properties.Settings.Default.proxyHost}, + {"proxyPort", Properties.Settings.Default.proxyPort}, + {"logFile", Properties.Settings.Default.logFile}, + {"neuterAccountNums", "true"} + }; + _litle = new LitleOnline(config); } [Test] - public void simpleEcheckCredit() + public void SimpleEcheckCredit() { - echeckCredit echeckcredit = new echeckCredit(); - echeckcredit.amount = 12L; - echeckcredit.litleTxnId = 123456789101112L; - echeckCreditResponse response = litle.EcheckCredit(echeckcredit); + var echeckcredit = new echeckCredit + { + amount = 12L, + litleTxnId = 123456789101112L + }; + var response = _litle.EcheckCredit(echeckcredit); Assert.AreEqual("Approved", response.message); } [Test] - public void noLitleTxnId() + public void NoLitleTxnId() { - echeckCredit echeckcredit = new echeckCredit(); + var echeckcredit = new echeckCredit(); try { - litle.EcheckCredit(echeckcredit); + _litle.EcheckCredit(echeckcredit); Assert.Fail("Expected exception"); } catch (LitleOnlineException e) @@ -44,67 +58,81 @@ public void noLitleTxnId() } [Test] - public void echeckCreditWithEcheck() + public void EcheckCreditWithEcheck() { - echeckCredit echeckcredit = new echeckCredit(); - echeckcredit.amount = 12L; - echeckcredit.orderId = "12345"; - echeckcredit.orderSource = orderSourceType.ecommerce; - echeckType echeck = new echeckType(); - echeck.accType = echeckAccountTypeEnum.Checking; - echeck.accNum = "12345657890"; - echeck.routingNum = "123456789"; - echeck.checkNum = "123455"; - echeckcredit.echeck = echeck; - contact billToAddress = new contact(); - billToAddress.name = "Bob"; - billToAddress.city = "Lowell"; - billToAddress.state = "MA"; - billToAddress.email = "litle.com"; - echeckcredit.billToAddress = billToAddress; - echeckCreditResponse response = litle.EcheckCredit(echeckcredit); + var echeckcredit = new echeckCredit + { + amount = 12L, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeck = new echeckType + { + accType = echeckAccountTypeEnum.Checking, + accNum = "12345657890", + routingNum = "123456789", + checkNum = "123455" + }, + billToAddress = new contact + { + name = "Bob", + city = "Lowell", + state = "MA", + email = "litle.com" + } + }; + + var response = _litle.EcheckCredit(echeckcredit); Assert.AreEqual("Approved", response.message); } [Test] - public void echeckCreditWithToken() + public void EcheckCreditWithToken() { - echeckCredit echeckcredit = new echeckCredit(); - echeckcredit.amount = 12L; - echeckcredit.orderId = "12345"; - echeckcredit.orderSource = orderSourceType.ecommerce; - echeckTokenType echeckToken = new echeckTokenType(); - echeckToken.accType = echeckAccountTypeEnum.Checking; - echeckToken.litleToken = "1234565789012"; - echeckToken.routingNum = "123456789"; - echeckToken.checkNum = "123455"; - echeckcredit.echeckToken = echeckToken; - contact billToAddress = new contact(); - billToAddress.name = "Bob"; - billToAddress.city = "Lowell"; - billToAddress.state = "MA"; - billToAddress.email = "litle.com"; - echeckcredit.billToAddress = billToAddress; - echeckCreditResponse response = litle.EcheckCredit(echeckcredit); + var echeckcredit = new echeckCredit + { + amount = 12L, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeckToken = new echeckTokenType + { + accType = echeckAccountTypeEnum.Checking, + litleToken = "1234565789012", + routingNum = "123456789", + checkNum = "123455" + }, + billToAddress = new contact + { + name = "Bob", + city = "Lowell", + state = "MA", + email = "litle.com" + } + }; + + var response = _litle.EcheckCredit(echeckcredit); Assert.AreEqual("Approved", response.message); } [Test] - public void missingBilling() + public void MissingBilling() { - echeckCredit echeckcredit = new echeckCredit(); - echeckcredit.amount = 12L; - echeckcredit.orderId = "12345"; - echeckcredit.orderSource = orderSourceType.ecommerce; - echeckType echeck = new echeckType(); - echeck.accType = echeckAccountTypeEnum.Checking; - echeck.accNum = "12345657890"; - echeck.routingNum = "123456789"; - echeck.checkNum = "123455"; - echeckcredit.echeck = echeck; + var echeckcredit = new echeckCredit + { + amount = 12L, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeck = new echeckType + { + accType = echeckAccountTypeEnum.Checking, + accNum = "12345657890", + routingNum = "123456789", + checkNum = "123455" + } + }; + try { - litle.EcheckCredit(echeckcredit); + _litle.EcheckCredit(echeckcredit); Assert.Fail("Expected exception"); } catch (LitleOnlineException e) @@ -114,38 +142,45 @@ public void missingBilling() } [Test] - public void echeckCreditWithSecondaryAmountWithOrderIdAndCcdPaymentInfo() + public void EcheckCreditWithSecondaryAmountWithOrderIdAndCcdPaymentInfo() { - echeckCredit echeckcredit = new echeckCredit(); - echeckcredit.amount = 12L; - echeckcredit.secondaryAmount = 50; - echeckcredit.orderId = "12345"; - echeckcredit.orderSource = orderSourceType.ecommerce; - echeckType echeck = new echeckType(); - echeck.accType = echeckAccountTypeEnum.Checking; - echeck.accNum = "12345657890"; - echeck.routingNum = "123456789"; - echeck.checkNum = "123455"; - echeck.ccdPaymentInformation = "9876554"; - echeckcredit.echeck = echeck; - contact billToAddress = new contact(); - billToAddress.name = "Bob"; - billToAddress.city = "Lowell"; - billToAddress.state = "MA"; - billToAddress.email = "litle.com"; - echeckcredit.billToAddress = billToAddress; - echeckCreditResponse response = litle.EcheckCredit(echeckcredit); + var echeckcredit = new echeckCredit + { + amount = 12L, + secondaryAmount = 50, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeck = new echeckType + { + accType = echeckAccountTypeEnum.Checking, + accNum = "12345657890", + routingNum = "123456789", + checkNum = "123455", + ccdPaymentInformation = "9876554" + }, + billToAddress = new contact + { + name = "Bob", + city = "Lowell", + state = "MA", + email = "litle.com" + } + }; + + var response = _litle.EcheckCredit(echeckcredit); Assert.AreEqual("Approved", response.message); } [Test] - public void echeckCreditWithSecondaryAmountWithLitleTxnId() + public void EcheckCreditWithSecondaryAmountWithLitleTxnId() { - echeckCredit echeckcredit = new echeckCredit(); - echeckcredit.amount = 12L; - echeckcredit.secondaryAmount = 50; - echeckcredit.litleTxnId = 12345L; - echeckCreditResponse response = litle.EcheckCredit(echeckcredit); + var echeckcredit = new echeckCredit + { + amount = 12L, + secondaryAmount = 50, + litleTxnId = 12345L + }; + var response = _litle.EcheckCredit(echeckcredit); Assert.AreEqual("Approved", response.message); } } diff --git a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestEcheckRedeposit.cs b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestEcheckRedeposit.cs index bc7b3112..15c7f415 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestEcheckRedeposit.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestEcheckRedeposit.cs @@ -1,71 +1,74 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; using NUnit.Framework; -using Litle.Sdk; namespace Litle.Sdk.Test.Functional { [TestFixture] - class TestEcheckRedeposit + internal class TestEcheckRedeposit { - private LitleOnline litle; + private LitleOnline _litle; [TestFixtureSetUp] - public void setUp() + public void SetUp() { - Dictionary config = new Dictionary(); - config.Add("url", "https://www.testlitle.com/sandbox/communicator/online"); - config.Add("reportGroup", "Default Report Group"); - config.Add("username", "DOTNET"); - config.Add("version", "8.13"); - config.Add("timeout", "65"); - config.Add("merchantId", "101"); - config.Add("password", "TESTCASE"); - config.Add("printxml", "true"); - config.Add("proxyHost", Properties.Settings.Default.proxyHost); - config.Add("proxyPort", Properties.Settings.Default.proxyPort); - config.Add("logFile", Properties.Settings.Default.logFile); - config.Add("neuterAccountNums", "true"); - litle = new LitleOnline(config); + var config = new Dictionary + { + {"url", "https://www.testlitle.com/sandbox/communicator/online"}, + {"reportGroup", "Default Report Group"}, + {"username", "DOTNET"}, + {"version", "8.13"}, + {"timeout", "5000"}, + {"merchantId", "101"}, + {"password", "TESTCASE"}, + {"printxml", "true"}, + {"proxyHost", Properties.Settings.Default.proxyHost}, + {"proxyPort", Properties.Settings.Default.proxyPort}, + {"logFile", Properties.Settings.Default.logFile}, + {"neuterAccountNums", "true"} + }; + _litle = new LitleOnline(config); } - [Test] - public void simpleEcheckRedeposit() { - echeckRedeposit echeckredeposit = new echeckRedeposit(); - echeckredeposit.litleTxnId = 123456; - echeckRedepositResponse response = litle.EcheckRedeposit(echeckredeposit); + public void SimpleEcheckRedeposit() { + var echeckredeposit = new echeckRedeposit {litleTxnId = 123456}; + var response = _litle.EcheckRedeposit(echeckredeposit); Assert.AreEqual("Approved", response.message); } [Test] - public void echeckRedepositWithEcheck() { - echeckRedeposit echeckredeposit = new echeckRedeposit(); - echeckredeposit.litleTxnId = 123456; - echeckType echeck = new echeckType(); - echeck.accType = echeckAccountTypeEnum.Checking; - echeck.accNum = "12345657890"; - echeck.routingNum = "123456789"; - echeck.checkNum = "123455"; - - echeckredeposit.echeck = echeck; - echeckRedepositResponse response = litle.EcheckRedeposit(echeckredeposit); + public void EcheckRedepositWithEcheck() { + var echeckredeposit = new echeckRedeposit + { + litleTxnId = 123456, + echeck = new echeckType + { + accType = echeckAccountTypeEnum.Checking, + accNum = "12345657890", + routingNum = "123456789", + checkNum = "123455" + } + }; + + var response = _litle.EcheckRedeposit(echeckredeposit); Assert.AreEqual("Approved", response.message); } [Test] - public void echeckRedepositWithEcheckToken() { - echeckRedeposit echeckredeposit = new echeckRedeposit(); - echeckredeposit.litleTxnId = 123456; - echeckTokenType echeckToken = new echeckTokenType(); - echeckToken.accType = echeckAccountTypeEnum.Checking; - echeckToken.litleToken = "1234565789012"; - echeckToken.routingNum = "123456789"; - echeckToken.checkNum = "123455"; - - echeckredeposit.token = echeckToken; - echeckRedepositResponse response = litle.EcheckRedeposit(echeckredeposit); + public void EcheckRedepositWithEcheckToken() { + var echeckredeposit = new echeckRedeposit + { + litleTxnId = 123456, + token = new echeckTokenType + { + accType = echeckAccountTypeEnum.Checking, + litleToken = "1234565789012", + routingNum = "123456789", + checkNum = "123455" + } + }; + + var response = _litle.EcheckRedeposit(echeckredeposit); Assert.AreEqual("Approved", response.message); } diff --git a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestEcheckSale.cs b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestEcheckSale.cs index abf9cb70..bc959e04 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestEcheckSale.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestEcheckSale.cs @@ -1,72 +1,71 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; using NUnit.Framework; -using Litle.Sdk; namespace Litle.Sdk.Test.Functional { [TestFixture] - class TestEcheckSale + internal class TestEcheckSale { - private LitleOnline litle; + private LitleOnline _litle; [TestFixtureSetUp] - public void setUp() + public void SetUp() { - Dictionary config = new Dictionary(); - config.Add("url", "https://www.testlitle.com/sandbox/communicator/online"); - config.Add("reportGroup", "Default Report Group"); - config.Add("username", "DOTNET"); - config.Add("version", "8.13"); - config.Add("timeout", "65"); - config.Add("merchantId", "101"); - config.Add("password", "TESTCASE"); - config.Add("printxml", "true"); - config.Add("proxyHost", Properties.Settings.Default.proxyHost); - config.Add("proxyPort", Properties.Settings.Default.proxyPort); - config.Add("logFile", Properties.Settings.Default.logFile); - config.Add("neuterAccountNums", "true"); - litle = new LitleOnline(config); + var config = new Dictionary + { + {"url", "https://www.testlitle.com/sandbox/communicator/online"}, + {"reportGroup", "Default Report Group"}, + {"username", "DOTNET"}, + {"version", "8.13"}, + {"timeout", "5000"}, + {"merchantId", "101"}, + {"password", "TESTCASE"}, + {"printxml", "true"}, + {"proxyHost", Properties.Settings.Default.proxyHost}, + {"proxyPort", Properties.Settings.Default.proxyPort}, + {"logFile", Properties.Settings.Default.logFile}, + {"neuterAccountNums", "true"} + }; + _litle = new LitleOnline(config); } [Test] public void SimpleEcheckSaleWithEcheck() { - echeckSale echeckSaleObj = new echeckSale(); - echeckSaleObj.amount = 123456; - echeckSaleObj.orderId = "12345"; - echeckSaleObj.orderSource = orderSourceType.ecommerce; - - echeckType echeckTypeObj = new echeckType(); - echeckTypeObj.accType = echeckAccountTypeEnum.Checking; - echeckTypeObj.accNum = "12345657890"; - echeckTypeObj.routingNum = "123456789"; - echeckTypeObj.checkNum = "123455"; - - contact contactObj = new contact(); - contactObj.name = "Bob"; - contactObj.city = "lowell"; - contactObj.state = "MA"; - contactObj.email = "litle.com"; - - echeckSaleObj.echeck = echeckTypeObj; - echeckSaleObj.billToAddress = contactObj; - - echeckSalesResponse response = litle.EcheckSale(echeckSaleObj); + var echeckSaleObj = new echeckSale + { + amount = 123456, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeck = new echeckType + { + accType = echeckAccountTypeEnum.Checking, + accNum = "12345657890", + routingNum = "123456789", + checkNum = "123455" + }, + billToAddress = new contact + { + name = "Bob", + city = "lowell", + state = "MA", + email = "litle.com" + } + }; + + var response = _litle.EcheckSale(echeckSaleObj); StringAssert.AreEqualIgnoringCase("Approved", response.message); } [Test] public void NoAmount() { - echeckSale echeckSaleObj = new echeckSale(); - echeckSaleObj.reportGroup = "Planets"; - + var echeckSaleObj = new echeckSale {reportGroup = "Planets"}; + try { - //expected exception; - echeckSalesResponse response = litle.EcheckSale(echeckSaleObj); + _litle.EcheckSale(echeckSaleObj); + Assert.Fail("Exception Expected!"); } catch (LitleOnlineException e) { @@ -77,87 +76,92 @@ public void NoAmount() [Test] public void EcheckSaleWithShipTo() { - echeckSale echeckSaleObj = new echeckSale(); - echeckSaleObj.reportGroup = "Planets"; - echeckSaleObj.amount = 123456; - echeckSaleObj.verify = true; - echeckSaleObj.orderId = "12345"; - echeckSaleObj.orderSource = orderSourceType.ecommerce; - - echeckType echeckTypeObj = new echeckType(); - echeckTypeObj.accType = echeckAccountTypeEnum.Checking; - echeckTypeObj.accNum = "12345657890"; - echeckTypeObj.routingNum = "123456789"; - echeckTypeObj.checkNum = "123455"; - - contact contactObj = new contact(); - contactObj.name = "Bob"; - contactObj.city = "lowell"; - contactObj.state = "MA"; - contactObj.email = "litle.com"; - - echeckSaleObj.echeck = echeckTypeObj; - echeckSaleObj.billToAddress = contactObj; - echeckSaleObj.shipToAddress = contactObj; - - echeckSalesResponse response = litle.EcheckSale(echeckSaleObj); + var contact = new contact + { + name = "Bob", + city = "lowell", + state = "MA", + email = "litle.com" + }; + + var echeckSaleObj = new echeckSale + { + reportGroup = "Planets", + amount = 123456, + verify = true, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeck = new echeckType + { + accType = echeckAccountTypeEnum.CorpSavings, + accNum = "12345657890", + routingNum = "123456789", + checkNum = "123455" + }, + billToAddress = contact, + shipToAddress = contact + }; + + var response = _litle.EcheckSale(echeckSaleObj); StringAssert.AreEqualIgnoringCase("Approved", response.message); } [Test] public void EcheckSaleWithEcheckToken() { - echeckSale echeckSaleObj = new echeckSale(); - echeckSaleObj.reportGroup = "Planets"; - echeckSaleObj.amount = 123456; - echeckSaleObj.verify = true; - echeckSaleObj.orderId = "12345"; - echeckSaleObj.orderSource = orderSourceType.ecommerce; - - echeckTokenType echeckTokenTypeObj = new echeckTokenType(); - echeckTokenTypeObj.accType = echeckAccountTypeEnum.Checking; - echeckTokenTypeObj.litleToken = "1234565789012"; - echeckTokenTypeObj.routingNum = "123456789"; - echeckTokenTypeObj.checkNum = "123455"; - - customBilling customBillingObj = new customBilling(); - customBillingObj.phone = "123456789"; - customBillingObj.descriptor = "good"; - - contact contactObj = new contact(); - contactObj.name = "Bob"; - contactObj.city = "lowell"; - contactObj.state = "MA"; - contactObj.email = "litle.com"; - - echeckSaleObj.token = echeckTokenTypeObj; - echeckSaleObj.customBilling = customBillingObj; - echeckSaleObj.billToAddress = contactObj; - - echeckSalesResponse response = litle.EcheckSale(echeckSaleObj); + var echeckSaleObj = new echeckSale + { + reportGroup = "Planets", + amount = 123456, + verify = true, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + token = new echeckTokenType + { + accType = echeckAccountTypeEnum.CorpSavings, + litleToken = "1234565789012", + routingNum = "123456789", + checkNum = "123455" + }, + customBilling = new customBilling + { + phone = "123456789", + descriptor = "good" + }, + billToAddress = new contact + { + name = "Bob", + city = "lowell", + state = "MA", + email = "litle.com" + } + }; + + var response = _litle.EcheckSale(echeckSaleObj); StringAssert.AreEqualIgnoringCase("Approved", response.message); } [Test] public void EcheckSaleMissingBilling() { - echeckSale echeckSaleObj = new echeckSale(); - echeckSaleObj.amount = 123456; - echeckSaleObj.orderId = "12345"; - echeckSaleObj.orderSource = orderSourceType.ecommerce; - - echeckType echeckTypeObj = new echeckType(); - echeckTypeObj.accType = echeckAccountTypeEnum.Checking; - echeckTypeObj.accNum = "12345657890"; - echeckTypeObj.routingNum = "123456789"; - echeckTypeObj.checkNum = "123455"; - - echeckSaleObj.echeck = echeckTypeObj; + var echeckSaleObj = new echeckSale + { + amount = 123456, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeck = new echeckType + { + accType = echeckAccountTypeEnum.Checking, + accNum = "12345657890", + routingNum = "123456789", + checkNum = "123455" + } + }; try { - //expected exception; - echeckSalesResponse response = litle.EcheckSale(echeckSaleObj); + _litle.EcheckSale(echeckSaleObj); + Assert.Fail("Exception expected!"); } catch (LitleOnlineException e) { @@ -168,54 +172,59 @@ public void EcheckSaleMissingBilling() [Test] public void SimpleEcheckSale() { - echeckSale echeckSaleObj = new echeckSale(); - echeckSaleObj.reportGroup = "Planets"; - echeckSaleObj.litleTxnId = 123456789101112; - echeckSaleObj.amount = 12; + var echeckSaleObj = new echeckSale + { + reportGroup = "Planets", + litleTxnId = 123456789101112, + amount = 12 + }; - echeckSalesResponse response = litle.EcheckSale(echeckSaleObj); + var response = _litle.EcheckSale(echeckSaleObj); StringAssert.AreEqualIgnoringCase("Approved", response.message); } [Test] public void SimpleEcheckSaleWithSecondaryAmountWithOrderId() { - echeckSale echeckSaleObj = new echeckSale(); - echeckSaleObj.amount = 123456; - echeckSaleObj.secondaryAmount = 50; - echeckSaleObj.orderId = "12345"; - echeckSaleObj.orderSource = orderSourceType.ecommerce; - - echeckType echeckTypeObj = new echeckType(); - echeckTypeObj.accType = echeckAccountTypeEnum.CorpSavings; - echeckTypeObj.accNum = "12345657890"; - echeckTypeObj.routingNum = "123456789"; - echeckTypeObj.checkNum = "123455"; - - contact contactObj = new contact(); - contactObj.name = "Bob"; - contactObj.city = "lowell"; - contactObj.state = "MA"; - contactObj.email = "litle.com"; - - echeckSaleObj.echeck = echeckTypeObj; - echeckSaleObj.billToAddress = contactObj; - - echeckSalesResponse response = litle.EcheckSale(echeckSaleObj); + var echeckSaleObj = new echeckSale + { + amount = 123456, + secondaryAmount = 50, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeck = new echeckType + { + accType = echeckAccountTypeEnum.CorpSavings, + accNum = "12345657890", + routingNum = "123456789", + checkNum = "123455" + }, + billToAddress = new contact + { + name = "Bob", + city = "lowell", + state = "MA", + email = "litle.com" + } + }; + + var response = _litle.EcheckSale(echeckSaleObj); StringAssert.AreEqualIgnoringCase("Approved", response.message); } [Test] public void SimpleEcheckSaleWithSecondaryAmount() { - echeckSale echeckSaleObj = new echeckSale(); - echeckSaleObj.amount = 123456; - echeckSaleObj.secondaryAmount = 50; - echeckSaleObj.litleTxnId = 1234565L; + var echeckSaleObj = new echeckSale + { + amount = 123456, + secondaryAmount = 50, + litleTxnId = 1234565L + }; try { - ////expected exception; - echeckSalesResponse response = litle.EcheckSale(echeckSaleObj); + _litle.EcheckSale(echeckSaleObj); + Assert.Fail("Exception expected!"); } catch (LitleOnlineException e) { diff --git a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestEcheckVerification.cs b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestEcheckVerification.cs index 77762b25..b2a71944 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestEcheckVerification.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestEcheckVerification.cs @@ -1,108 +1,112 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; using NUnit.Framework; -using Litle.Sdk; namespace Litle.Sdk.Test.Functional { [TestFixture] - class TestEcheckVerification + internal class TestEcheckVerification { - private LitleOnline litle; + private LitleOnline _litle; [TestFixtureSetUp] - public void setUp() + public void SetUp() { - Dictionary config = new Dictionary(); - config.Add("url", "https://www.testlitle.com/sandbox/communicator/online"); - config.Add("reportGroup", "Default Report Group"); - config.Add("username", "DOTNET"); - config.Add("version", "8.13"); - config.Add("timeout", "65"); - config.Add("merchantId", "101"); - config.Add("password", "TESTCASE"); - config.Add("printxml", "true"); - config.Add("proxyHost", Properties.Settings.Default.proxyHost); - config.Add("proxyPort", Properties.Settings.Default.proxyPort); - config.Add("logFile", Properties.Settings.Default.logFile); - config.Add("neuterAccountNums", "true"); - litle = new LitleOnline(config); + var config = new Dictionary + { + {"url", "https://www.testlitle.com/sandbox/communicator/online"}, + {"reportGroup", "Default Report Group"}, + {"username", "DOTNET"}, + {"version", "8.13"}, + {"timeout", "5000"}, + {"merchantId", "101"}, + {"password", "TESTCASE"}, + {"printxml", "true"}, + {"proxyHost", Properties.Settings.Default.proxyHost}, + {"proxyPort", Properties.Settings.Default.proxyPort}, + {"logFile", Properties.Settings.Default.logFile}, + {"neuterAccountNums", "true"} + }; + _litle = new LitleOnline(config); } [Test] public void SimpleEcheckVerification() { - echeckVerification echeckVerificationObject = new echeckVerification(); - echeckVerificationObject.amount = 123456; - echeckVerificationObject.orderId = "12345"; - echeckVerificationObject.orderSource = orderSourceType.ecommerce; - - echeckType echeckTypeObj = new echeckType(); - echeckTypeObj.accType = echeckAccountTypeEnum.Checking; - echeckTypeObj.accNum = "12345657890"; - echeckTypeObj.routingNum = "123456789"; - echeckTypeObj.checkNum = "123455"; - - contact contactObj = new contact(); - contactObj.name = "Bob"; - contactObj.city = "lowell"; - contactObj.state = "MA"; - contactObj.email = "litle.com"; - - echeckVerificationObject.echeck = echeckTypeObj; - echeckVerificationObject.billToAddress = contactObj; + var echeckVerificationObject = new echeckVerification + { + amount = 123456, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeck = new echeckType + { + accType = echeckAccountTypeEnum.Checking, + accNum = "12345657890", + routingNum = "123456789", + checkNum = "123455" + }, + billToAddress = new contact + { + name = "Bob", + city = "lowell", + state = "MA", + email = "litle.com" + } + }; - echeckVerificationResponse response = litle.EcheckVerification(echeckVerificationObject); + var response = _litle.EcheckVerification(echeckVerificationObject); StringAssert.AreEqualIgnoringCase("Approved", response.message); } [Test] public void EcheckVerificationWithEcheckToken() { - echeckVerification echeckVerificationObject = new echeckVerification(); - echeckVerificationObject.amount = 123456; - echeckVerificationObject.orderId = "12345"; - echeckVerificationObject.orderSource = orderSourceType.ecommerce; - - echeckTokenType echeckTokenObj = new echeckTokenType(); - echeckTokenObj.accType = echeckAccountTypeEnum.Checking; - echeckTokenObj.litleToken = "1234565789012"; - echeckTokenObj.routingNum = "123456789"; - echeckTokenObj.checkNum = "123455"; - - contact contactObj = new contact(); - contactObj.name = "Bob"; - contactObj.city = "lowell"; - contactObj.state = "MA"; - contactObj.email = "litle.com"; - - echeckVerificationObject.token = echeckTokenObj; - echeckVerificationObject.billToAddress = contactObj; + var echeckVerificationObject = new echeckVerification + { + amount = 123456, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + token = new echeckTokenType + { + accType = echeckAccountTypeEnum.Checking, + litleToken = "1234565789012", + routingNum = "123456789", + checkNum = "123455" + }, + billToAddress = new contact + { + name = "Bob", + city = "lowell", + state = "MA", + email = "litle.com" + } + }; - echeckVerificationResponse response = litle.EcheckVerification(echeckVerificationObject); + var response = _litle.EcheckVerification(echeckVerificationObject); StringAssert.AreEqualIgnoringCase("Approved", response.message); } [Test] public void TestMissingBillingField() { - echeckVerification echeckVerificationObject = new echeckVerification(); - echeckVerificationObject.reportGroup = "Planets"; - echeckVerificationObject.amount = 123; - echeckVerificationObject.orderId = "12345"; - echeckVerificationObject.orderSource = orderSourceType.ecommerce; + var echeckVerificationObject = new echeckVerification + { + reportGroup = "Planets", + amount = 123, + orderId = "12345", + orderSource = orderSourceType.ecommerce, + echeck = new echeckType + { + accType = echeckAccountTypeEnum.Checking, + accNum = "12345657890", + routingNum = "123456789", + checkNum = "123455" + } + }; - echeckType echeckTypeObj = new echeckType(); - echeckTypeObj.accType = echeckAccountTypeEnum.Checking; - echeckTypeObj.accNum = "12345657890"; - echeckTypeObj.routingNum = "123456789"; - echeckTypeObj.checkNum = "123455"; - echeckVerificationObject.echeck = echeckTypeObj; try { - //expected exception; - echeckVerificationResponse response = litle.EcheckVerification(echeckVerificationObject); + _litle.EcheckVerification(echeckVerificationObject); + Assert.Fail("Exception expected!"); } catch (LitleOnlineException e) { diff --git a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestForceCapture.cs b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestForceCapture.cs index 23e77604..c521d886 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestForceCapture.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestForceCapture.cs @@ -1,83 +1,117 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; using NUnit.Framework; -using Litle.Sdk; namespace Litle.Sdk.Test.Functional { [TestFixture] - class TestForceCapture + internal class TestForceCapture { - private LitleOnline litle; + private LitleOnline _litle; [TestFixtureSetUp] - public void setUp() + public void SetUp() { - Dictionary config = new Dictionary(); - config.Add("url", "https://www.testlitle.com/sandbox/communicator/online"); - config.Add("reportGroup", "Default Report Group"); - config.Add("username", "DOTNET"); - config.Add("version", "8.13"); - config.Add("timeout", "65"); - config.Add("merchantId", "101"); - config.Add("password", "TESTCASE"); - config.Add("printxml", "true"); - config.Add("proxyHost", Properties.Settings.Default.proxyHost); - config.Add("proxyPort", Properties.Settings.Default.proxyPort); - config.Add("logFile", Properties.Settings.Default.logFile); - config.Add("neuterAccountNums", "true"); - litle = new LitleOnline(config); + var config = new Dictionary + { + { "url", "https://www.testlitle.com/sandbox/communicator/online"}, + {"reportGroup", "Default Report Group"}, + {"username", "DOTNET"}, + {"version", "8.13"}, + {"timeout", "5000"}, + {"merchantId", "101"}, + {"password", "TESTCASE"}, + {"printxml", "true"}, + {"proxyHost", Properties.Settings.Default.proxyHost}, + {"proxyPort", Properties.Settings.Default.proxyPort}, + {"logFile", Properties.Settings.Default.logFile}, + {"neuterAccountNums", "true"} + }; + + _litle = new LitleOnline(config); } [Test] - public void simpleForceCaptureWithCard() { - forceCapture forcecapture = new forceCapture(); - forcecapture.amount = 106; - forcecapture.orderId = "12344"; - forcecapture.orderSource = orderSourceType.ecommerce; - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.VI; - card.number = "4100000000000001"; - card.expDate = "1210"; - forcecapture.card = card; - forceCaptureResponse response = litle.ForceCapture(forcecapture); + public void SimpleForceCaptureWithCard() { + var forcecapture = new forceCapture + { + amount = 106, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000001", + expDate = "1210" + } + }; + + var response = _litle.ForceCapture(forcecapture); Assert.AreEqual("Approved", response.message); } [Test] - public void simpleForceCaptureWithMpos() + public void SimpleForceCaptureWithMpos() { - mposType mpos = new mposType(); - mpos.ksn = "77853211300008E00016"; - mpos.encryptedTrack = "CASE1E185EADD6AFE78C9A214B21313DCD836FDD555FBE3A6C48D141FE80AB9172B963265AFF72111895FE415DEDA162CE8CB7AC4D91EDB611A2AB756AA9CB1A000000000000000000000000000000005A7AAF5E8885A9DB88ECD2430C497003F2646619A2382FFF205767492306AC804E8E64E8EA6981DD"; - mpos.formatId = "30"; - mpos.track1Status = 0; - mpos.track2Status = 0; - forceCapture forcecapture = new forceCapture(); - forcecapture.amount = 322; - forcecapture.orderId = "12344"; - forcecapture.orderSource = orderSourceType.ecommerce; - forcecapture.mpos = mpos; - forceCaptureResponse response = litle.ForceCapture(forcecapture); + var forcecapture = new forceCapture + { + amount = 322, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + mpos = new mposType + { + ksn = "77853211300008E00016", + encryptedTrack = + "CASE1E185EADD6AFE78C9A214B21313DCD836FDD555FBE3A6C48D141FE80AB9172B963265AFF72111895FE415DEDA162CE8CB7AC4D91EDB611A2AB756AA9CB1A000000000000000000000000000000005A7AAF5E8885A9DB88ECD2430C497003F2646619A2382FFF205767492306AC804E8E64E8EA6981DD", + formatId = "30", + track1Status = 0, + track2Status = 0 + } + }; + + var response = _litle.ForceCapture(forcecapture); Assert.AreEqual("Approved", response.message); } [Test] - public void simpleForceCaptureWithToken() { - forceCapture forcecapture = new forceCapture(); - forcecapture.amount = 106; - forcecapture.orderId = "12344"; - forcecapture.orderSource = orderSourceType.ecommerce; - cardTokenType token = new cardTokenType(); - token.litleToken = "123456789101112"; - token.expDate = "1210"; - token.cardValidationNum = "555"; - token.type = methodOfPaymentTypeEnum.VI; - forcecapture.token = token; - forceCaptureResponse response = litle.ForceCapture(forcecapture); - Assert.AreEqual("Approved", response.message); ; - } + public void SimpleForceCaptureWithToken() { + var forcecapture = new forceCapture + { + amount = 106, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + token = new cardTokenType + { + litleToken = "123456789101112", + expDate = "1210", + cardValidationNum = "555", + type = methodOfPaymentTypeEnum.VI + } + }; + var response = _litle.ForceCapture(forcecapture); + Assert.AreEqual("Approved", response.message); + } + + [Test] + public void SimpleForceCaptureWithProcessingType() + { + var forcecapture = new forceCapture + { + amount = 106, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000001", + expDate = "1210" + }, + processingType = processingType.initialRecurring + }; + + var response = _litle.ForceCapture(forcecapture); + Assert.AreEqual("Approved", response.message); + } + } } diff --git a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestFraudCheck.cs b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestFraudCheck.cs new file mode 100644 index 00000000..48e94c98 --- /dev/null +++ b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestFraudCheck.cs @@ -0,0 +1,101 @@ +using NUnit.Framework; +using System.Collections.Generic; + + +namespace Litle.Sdk.Test.Functional +{ + [TestFixture] + internal class TestFraudCheck + { + private LitleOnline _litle; + private Dictionary _config; + + [TestFixtureSetUp] + public void SetUpLitle() + { + _config = new Dictionary + { + {"url", "https://www.testlitle.com/sandbox/communicator/online"}, + {"reportGroup", "Default Report Group"}, + {"username", "DOTNET"}, + {"version", "8.13"}, + {"timeout", "5000"}, + {"merchantId", "101"}, + {"password", "TESTCASE"}, + {"printxml", "true"}, + {"proxyHost", Properties.Settings.Default.proxyHost}, + {"proxyPort", Properties.Settings.Default.proxyPort}, + {"logFile", Properties.Settings.Default.logFile}, + {"neuterAccountNums", "true"} + }; + _litle = new LitleOnline(_config); + } + + [Test] + public void TestCustomAttribute7TriggeredRules() + { + var fraudCheck = new fraudCheck + { + advancedFraudChecks = new advancedFraudChecksType + { + threatMetrixSessionId = "123", + customAttribute1 = "pass", + customAttribute2 = "60", + customAttribute3 = "7", + customAttribute4 = "jkl", + customAttribute5 = "mno" + } + }; + + var fraudCheckResponse = _litle.FraudCheck(fraudCheck); + + Assert.NotNull(fraudCheckResponse); + Assert.AreEqual(60, fraudCheckResponse.advancedFraudResults.deviceReputationScore); + // TODO: we should be parsing multiple triggered rules, noit just the first one + //Assert.AreEqual(7, fraudCheckResponse.advancedFraudResults.triggeredRule.Length); + Assert.AreEqual("triggered_rule_1", fraudCheckResponse.advancedFraudResults.triggeredRule); + } + + [Test] + public void TestFraudCheckWithAddressAndAmount() + { + var fraudCheck = new fraudCheck + { + amount = 51699, + billToAddress = new contact + { + firstName = "Bob", + lastName = "Bagels", + addressLine1 = "37 Main Street", + city = "Augusta", + state = "Wisconsin", + zip = "28209" + }, + shipToAddress = new contact + { + firstName = "P", + lastName = "Sherman", + addressLine1 = "42 Wallaby Way", + city = "Sydney", + state = "New South Wales", + zip = "2127" + }, + advancedFraudChecks = new advancedFraudChecksType + { + threatMetrixSessionId = "123", + customAttribute1 = "fail", + customAttribute2 = "60", + customAttribute3 = "7", + customAttribute4 = "jkl", + customAttribute5 = "mno" + } + }; + + var fraudCheckResponse = _litle.FraudCheck(fraudCheck); + Assert.NotNull(fraudCheckResponse); + Assert.AreEqual("Call Discover", fraudCheckResponse.message); + Assert.AreEqual("fail", fraudCheckResponse.advancedFraudResults.deviceReviewStatus); + + } + } +} diff --git a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestRegisterTokenRequest.cs b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestRegisterTokenRequest.cs new file mode 100644 index 00000000..38b0c8f0 --- /dev/null +++ b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestRegisterTokenRequest.cs @@ -0,0 +1,51 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Litle.Sdk.Test.Functional +{ + internal class TestRegisterTokenRequest + { + private LitleOnline _litle; + + [TestFixtureSetUp] + public void SetUpLitle() + { + var config = new Dictionary + { + {"url", "https://www.testlitle.com/sandbox/communicator/online"}, + {"reportGroup", "Default Report Group"}, + {"username", "DOTNET"}, + {"version", "9.12"}, + {"timeout", "5000"}, + {"merchantId", "101"}, + {"password", "TESTCASE"}, + {"printxml", "true"}, + {"proxyHost", Properties.Settings.Default.proxyHost}, + {"proxyPort", Properties.Settings.Default.proxyPort}, + {"logFile", Properties.Settings.Default.logFile}, + {"neuterAccountNums", "true"} + }; + _litle = new LitleOnline(config); + } + + [Test] + public void TestSimpleRegisterTokenRequest() + { + var tokenRequest = new registerTokenRequestType + { + orderId = "androidpay", + accountNumber = "4100000000000001", + paypageRegistrationId = "558987412" + }; + + var tokenResponse = _litle.RegisterToken(tokenRequest); + Assert.AreEqual("01", tokenResponse.androidpayResponse.expMonth); + Assert.AreEqual("2050", tokenResponse.androidpayResponse.expYear); + Assert.NotNull(tokenResponse.androidpayResponse.cryptogram); + } + } +} diff --git a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestSale.cs b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestSale.cs index 2d728df6..cae9001a 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestSale.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestSale.cs @@ -1,145 +1,308 @@ -using System; -using System.Collections.Generic; -using System.Text; -using NUnit.Framework; -using Litle.Sdk; - -namespace Litle.Sdk.Test.Functional -{ - [TestFixture] - class TestSale - { - private LitleOnline litle; - - [TestFixtureSetUp] - public void setUp() - { - Dictionary config = new Dictionary(); - config.Add("url", "https://www.testlitle.com/sandbox/communicator/online"); - config.Add("reportGroup", "Default Report Group"); - config.Add("username", "DOTNET"); - config.Add("version", "8.13"); - config.Add("timeout", "65"); - config.Add("merchantId", "101"); - config.Add("password", "TESTCASE"); - config.Add("printxml", "true"); - config.Add("proxyHost", Properties.Settings.Default.proxyHost); - config.Add("proxyPort", Properties.Settings.Default.proxyPort); - config.Add("logFile", Properties.Settings.Default.logFile); - config.Add("neuterAccountNums", "true"); - litle = new LitleOnline(config); - } - - [Test] - public void SimpleSaleWithCard() - { - sale saleObj = new sale(); - saleObj.amount = 106; - saleObj.litleTxnId = 123456; - saleObj.orderId = "12344"; - saleObj.orderSource = orderSourceType.ecommerce; - cardType cardObj = new cardType(); - cardObj.type = methodOfPaymentTypeEnum.VI; - cardObj.number = "4100000000000000"; - cardObj.expDate = "1210"; - saleObj.card = cardObj; - - saleResponse responseObj = litle.Sale(saleObj); - StringAssert.AreEqualIgnoringCase("Approved", responseObj.message); - } - - [Test] - public void SimpleSaleWithMpos() - { - sale saleObj = new sale(); - saleObj.amount = 106; - saleObj.litleTxnId = 123456; - saleObj.orderId = "12344"; - saleObj.orderSource = orderSourceType.ecommerce; - mposType mpos = new mposType(); - mpos.ksn = "77853211300008E00016"; - mpos.encryptedTrack = "CASE1E185EADD6AFE78C9A214B21313DCD836FDD555FBE3A6C48D141FE80AB9172B963265AFF72111895FE415DEDA162CE8CB7AC4D91EDB611A2AB756AA9CB1A000000000000000000000000000000005A7AAF5E8885A9DB88ECD2430C497003F2646619A2382FFF205767492306AC804E8E64E8EA6981DD"; - mpos.formatId = "30"; - mpos.track1Status = 0; - mpos.track2Status = 0; ; - saleObj.mpos = mpos; - - saleResponse responseObj = litle.Sale(saleObj); - StringAssert.AreEqualIgnoringCase("Approved", responseObj.message); - } - - [Test] - public void SimpleSaleWithPayPal() - { - sale saleObj = new sale(); - saleObj.amount = 106; - saleObj.litleTxnId = 123456; - saleObj.orderId = "12344"; - saleObj.orderSource = orderSourceType.ecommerce; - payPal payPalObj = new payPal(); - payPalObj.payerId = "1234"; - payPalObj.token = "1234"; - payPalObj.transactionId = "123456"; - saleObj.paypal = payPalObj; - saleResponse responseObj = litle.Sale(saleObj); - StringAssert.AreEqualIgnoringCase("Approved", responseObj.message); - } - - [Test] - public void SimpleSaleWithApplepayAndSecondaryAmountAndWallet() - { - sale saleObj = new sale(); - saleObj.amount = 110; - saleObj.secondaryAmount = 50; - saleObj.litleTxnId = 123456; - saleObj.orderId = "12344"; - saleObj.orderSource = orderSourceType.ecommerce; - applepayType applepay = new applepayType(); - applepayHeaderType applepayHeaderType = new applepayHeaderType(); - applepayHeaderType.applicationData = "454657413164"; - applepayHeaderType.ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; - applepayHeaderType.publicKeyHash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; - applepayHeaderType.transactionId = "1234"; - applepay.header = applepayHeaderType; - applepay.data = "user"; - applepay.signature = "sign"; - applepay.version = "1"; - saleObj.applepay = applepay; - wallet wallet = new Sdk.wallet(); - wallet.walletSourceTypeId = "123"; - wallet.walletSourceType = walletWalletSourceType.MasterPass; - saleObj.wallet = wallet; - - saleResponse responseObj = litle.Sale(saleObj); - Assert.AreEqual("Insufficient Funds", responseObj.message); - Assert.AreEqual("110", responseObj.applepayResponse.transactionAmount); - } - - [Test] - public void SimpleSaleWithInvalidFraudCheck() - { - sale saleObj = new sale(); - saleObj.amount = 106; - saleObj.litleTxnId = 123456; - saleObj.orderId = "12344"; - saleObj.orderSource = orderSourceType.ecommerce; - cardType cardObj = new cardType(); - cardObj.type = methodOfPaymentTypeEnum.VI; - cardObj.number = "4100000000000000"; - cardObj.expDate = "1210"; - saleObj.card = cardObj; - fraudCheckType cardholderAuthentication = new fraudCheckType(); - cardholderAuthentication.authenticationValue = "123456789012345678901234567890123456789012345678901234567890"; - saleObj.cardholderAuthentication = cardholderAuthentication; - - try - { - saleResponse responseObj = litle.Sale(saleObj); - } - catch (LitleOnlineException e) - { - Assert.True(e.Message.StartsWith("Error validating xml data against the schema")); - } - } - } -} +using System.Collections.Generic; +using NUnit.Framework; + +namespace Litle.Sdk.Test.Functional +{ + [TestFixture] + internal class TestSale + { + private LitleOnline _litle; + + [TestFixtureSetUp] + public void SetUp() + { + var config = new Dictionary + { + {"url", "https://www.testlitle.com/sandbox/communicator/online"}, + {"reportGroup", "Default Report Group"}, + {"username", "DOTNET"}, + {"version", "9.12"}, + {"timeout", "5000"}, + {"merchantId", "101"}, + {"password", "TESTCASE"}, + {"printxml", "true"}, + {"proxyHost", Properties.Settings.Default.proxyHost}, + {"proxyPort", Properties.Settings.Default.proxyPort}, + {"logFile", Properties.Settings.Default.logFile}, + {"neuterAccountNums", "true"} + }; + + _litle = new LitleOnline(config); + } + + [Test] + public void SimpleSaleWithCard() + { + var saleObj = new sale + { + amount = 106, + litleTxnId = 123456, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000000", + expDate = "1210" + } + }; + + var responseObj = _litle.Sale(saleObj); + StringAssert.AreEqualIgnoringCase("Approved", responseObj.message); + } + + [Test] + public void SaleWithCard_AndroidpayResponse() + { + var saleObj = new sale + { + amount = 106, + litleTxnId = 123456, + orderId = "12344", + orderSource = orderSourceType.androidpay, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000000", + expDate = "1210" + } + }; + + var responseObj = _litle.Sale(saleObj); + StringAssert.AreEqualIgnoringCase("Approved", responseObj.message); + Assert.AreEqual("01", responseObj.androidpayResponse.expMonth); + Assert.AreEqual("2050", responseObj.androidpayResponse.expYear); + } + + [Test] + public void SaleWithCard_withProcessingTypeAndCardSuffixResponse() + { + var saleObj = new sale + { + amount = 106, + litleTxnId = 123456, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + processingType = processingType.accountFunding, + originalNetworkTransactionId = "12345678912345", + originalTransactionAmount = 1492, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100700000000000", + expDate = "1210" + } + }; + + var responseObj = _litle.Sale(saleObj); + StringAssert.AreEqualIgnoringCase("Approved", responseObj.message); + Assert.AreEqual("123456", responseObj.cardSuffix); + } + + [Test] + public void SaleWithCard_withProcessingTypeAndNetworkTxnId() + { + var saleObj = new sale + { + amount = 106, + litleTxnId = 123456, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + processingType = processingType.accountFunding, + originalNetworkTransactionId = "12345678912345", + originalTransactionAmount = 1492, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100700000000000", + expDate = "1210", + pin = "9876" + } + }; + + var responseObj = _litle.Sale(saleObj); + StringAssert.AreEqualIgnoringCase("Approved", responseObj.message); + Assert.AreEqual("63225578415568556365452427825", responseObj.networkTransactionId); + } + + [Test] + public void SaleWithMasterCard_withProcessingTypeAndNetworkTxnId() + { + var saleObj = new sale + { + amount = 106, + litleTxnId = 123456, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + processingType = processingType.accountFunding, + originalNetworkTransactionId = "12345678912345", + originalTransactionAmount = 1492, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "5400700000000000", + expDate = "1210" + } + }; + + var responseObj = _litle.Sale(saleObj); + StringAssert.AreEqualIgnoringCase("Approved", responseObj.message); + Assert.Null(responseObj.networkTransactionId); + } + + [Test] + public void SimpleSaleWithMpos() + { + var saleObj = new sale + { + amount = 106, + litleTxnId = 123456, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + mpos = new mposType + { + ksn = "77853211300008E00016", + encryptedTrack = + "CASE1E185EADD6AFE78C9A214B21313DCD836FDD555FBE3A6C48D141FE80AB9172B963265AFF72111895FE415DEDA162CE8CB7AC4D91EDB611A2AB756AA9CB1A000000000000000000000000000000005A7AAF5E8885A9DB88ECD2430C497003F2646619A2382FFF205767492306AC804E8E64E8EA6981DD", + formatId = "30", + track1Status = 0, + track2Status = 0 + } + }; + + var responseObj = _litle.Sale(saleObj); + StringAssert.AreEqualIgnoringCase("Approved", responseObj.message); + } + + [Test] + public void SimpleSaleWithPayPal() + { + var saleObj = new sale + { + amount = 106, + litleTxnId = 123456, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + paypal = new payPal + { + payerId = "1234", + token = "1234", + transactionId = "123456" + } + }; + + var responseObj = _litle.Sale(saleObj); + StringAssert.AreEqualIgnoringCase("Approved", responseObj.message); + } + + [Test] + public void SimpleSaleWithApplepayAndSecondaryAmountAndWallet() + { + var saleObj = new sale + { + amount = 110, + secondaryAmount = 50, + litleTxnId = 123456, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + applepay = new applepayType + { + data = "user", + signature = "sign", + version = "12345", + header = new applepayHeaderType + { + applicationData = "454657413164", + ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + publicKeyHash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + transactionId = "1234" + } + }, + wallet = new wallet + { + walletSourceTypeId = "123", + walletSourceType = walletWalletSourceType.MasterPass + } + }; + + var responseObj = _litle.Sale(saleObj); + Assert.AreEqual("Insufficient Funds", responseObj.message); + Assert.AreEqual("110", responseObj.applepayResponse.transactionAmount); + } + + [Test] + public void SimpleSaleWithInvalidFraudCheck() + { + var saleObj = new sale + { + amount = 106, + litleTxnId = 123456, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000000", + expDate = "1210" + }, + cardholderAuthentication = new fraudCheckType + { + authenticationValue = "1234567890123456789012345678901234567890123456789012345678907897987987897897987897979797897897979797997798789" + } + }; + + try + { + _litle.Sale(saleObj); + Assert.Fail("Exception expected!"); + } + catch (LitleOnlineException e) + { + Assert.True(e.Message.StartsWith("Error validating xml data against the schema")); + } + } + + [Test] + public void SimpleSaleWithsepaDirectDebit() + { + var saleObj = new sale + { + amount = 106, + litleTxnId = 123456, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + sepaDirectDebit = new sepaDirectDebitType + { + iban = "SepaDirectDebit Iban", + mandateProvider = "Merchant", + sequenceType = sequenceType.OneTime + }, + }; + + var responseObj = _litle.Sale(saleObj); + Assert.AreEqual("http://redirect.url.vantiv.com", responseObj.sepaDirectDebitResponse.redirectUrl); + Assert.AreEqual("jj2d1d372osmmt7tb8epm0a99q", responseObj.sepaDirectDebitResponse.redirectToken); + } + + [Test] + public void SimpleSaleWithideal() + { + var saleObj = new sale + { + amount = 106, + litleTxnId = 123456, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + ideal = new idealType + { + preferredLanguage = countryTypeEnum.AD, + }, + }; + + var responseObj = _litle.Sale(saleObj); + Assert.AreEqual("http://redirect.url.vantiv.com", responseObj.idealResponse.redirectUrl); + Assert.AreEqual("jj2d1d372osmmt7tb8epm0a99q", responseObj.idealResponse.redirectToken); + } + + } +} diff --git a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestToken.cs b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestToken.cs index 0d70f839..8c6fcc16 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestToken.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestToken.cs @@ -1,43 +1,47 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; using NUnit.Framework; -using Litle.Sdk; + namespace Litle.Sdk.Test.Functional { [TestFixture] - class TestToken + internal class TestToken { - private LitleOnline litle; + private LitleOnline _litle; [TestFixtureSetUp] - public void setUp() + public void SetUp() { - Dictionary config = new Dictionary(); - config.Add("url", "https://www.testlitle.com/sandbox/communicator/online"); - config.Add("reportGroup", "Default Report Group"); - config.Add("username", "DOTNET"); - config.Add("version", "8.13"); - config.Add("timeout", "65"); - config.Add("merchantId", "101"); - config.Add("password", "TESTCASE"); - config.Add("printxml", "true"); - config.Add("proxyHost", Properties.Settings.Default.proxyHost); - config.Add("proxyPort", Properties.Settings.Default.proxyPort); - config.Add("logFile", Properties.Settings.Default.logFile); - config.Add("neuterAccountNums", "true"); - litle = new LitleOnline(config); + var config = new Dictionary + { + {"url", "https://www.testlitle.com/sandbox/communicator/online"}, + {"reportGroup", "Default Report Group"}, + {"username", "DOTNET"}, + {"version", "8.13"}, + {"timeout", "5000"}, + {"merchantId", "101"}, + {"password", "TESTCASE"}, + {"printxml", "true"}, + {"proxyHost", Properties.Settings.Default.proxyHost}, + {"proxyPort", Properties.Settings.Default.proxyPort}, + {"logFile", Properties.Settings.Default.logFile}, + {"neuterAccountNums", "true"} + }; + _litle = new LitleOnline(config); } [Test] public void SimpleToken() { - registerTokenRequestType registerTokenRequest = new registerTokenRequestType(); - registerTokenRequest.orderId = "12344"; - registerTokenRequest.accountNumber = "1233456789103801"; - registerTokenRequest.reportGroup = "Planets"; - registerTokenResponse rtokenResponse = litle.RegisterToken(registerTokenRequest); + var registerTokenRequest = new registerTokenRequestType + { + orderId = "12344", + accountNumber = "1233456789103801", + reportGroup = "Planets" + }; + + var rtokenResponse = _litle.RegisterToken(registerTokenRequest); + StringAssert.AreEqualIgnoringCase("Account number was successfully registered", rtokenResponse.message); } @@ -45,46 +49,61 @@ public void SimpleToken() [Test] public void SimpleTokenWithPayPage() { - registerTokenRequestType registerTokenRequest = new registerTokenRequestType(); - registerTokenRequest.orderId = "12344"; - registerTokenRequest.paypageRegistrationId = "1233456789101112"; - registerTokenRequest.reportGroup = "Planets"; - registerTokenResponse rtokenResponse = litle.RegisterToken(registerTokenRequest); + var registerTokenRequest = new registerTokenRequestType + { + orderId = "12344", + paypageRegistrationId = "1233456789101112", + reportGroup = "Planets" + }; + + var rtokenResponse = _litle.RegisterToken(registerTokenRequest); + StringAssert.AreEqualIgnoringCase("Account number was successfully registered", rtokenResponse.message); } [Test] public void SimpleTokenWithEcheck() { - registerTokenRequestType registerTokenRequest = new registerTokenRequestType(); - registerTokenRequest.orderId = "12344"; - echeckForTokenType echeckObj = new echeckForTokenType(); - echeckObj.accNum = "12344565"; - echeckObj.routingNum = "123476545"; - registerTokenRequest.echeckForToken = echeckObj; - registerTokenRequest.reportGroup = "Planets"; - registerTokenResponse rtokenResponse = litle.RegisterToken(registerTokenRequest); + var registerTokenRequest = new registerTokenRequestType + { + orderId = "12344", + reportGroup = "Planets", + echeckForToken = new echeckForTokenType + { + accNum = "12344565", + routingNum = "123476545" + } + }; + + var rtokenResponse = _litle.RegisterToken(registerTokenRequest); + StringAssert.AreEqualIgnoringCase("Account number was successfully registered", rtokenResponse.message); } [Test] public void SimpleTokenWithApplepay() { - registerTokenRequestType registerTokenRequest = new registerTokenRequestType(); - registerTokenRequest.orderId = "12344"; - registerTokenRequest.reportGroup = "Planets"; - applepayType applepay = new applepayType(); - applepayHeaderType applepayHeaderType = new applepayHeaderType(); - applepayHeaderType.applicationData = "454657413164"; - applepayHeaderType.ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; - applepayHeaderType.publicKeyHash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; - applepayHeaderType.transactionId = "1234"; - applepay.header = applepayHeaderType; - applepay.data = "user"; - applepay.signature = "sign"; - applepay.version = "1"; - registerTokenRequest.applepay = applepay; - registerTokenResponse rtokenResponse = litle.RegisterToken(registerTokenRequest); + var registerTokenRequest = new registerTokenRequestType + { + orderId = "12344", + reportGroup = "Planets", + applepay = new applepayType + { + data = "user", + signature = "sign", + version = "12345", + header = new applepayHeaderType + { + applicationData = "454657413164", + ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + publicKeyHash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + transactionId = "1234" + } + } + }; + + var rtokenResponse = _litle.RegisterToken(registerTokenRequest); + StringAssert.AreEqualIgnoringCase("Account number was successfully registered", rtokenResponse.message); Assert.AreEqual("0", rtokenResponse.applepayResponse.transactionAmount); } @@ -92,16 +111,17 @@ public void SimpleTokenWithApplepay() [Test] public void TokenEcheckMissingRequiredField() { - registerTokenRequestType registerTokenRequest = new registerTokenRequestType(); - registerTokenRequest.orderId = "12344"; - echeckForTokenType echeckObj = new echeckForTokenType(); - echeckObj.routingNum = "123476545"; - registerTokenRequest.echeckForToken = echeckObj; - registerTokenRequest.reportGroup = "Planets"; + var registerTokenRequest = new registerTokenRequestType + { + orderId = "12344", + reportGroup = "Planets", + echeckForToken = new echeckForTokenType { routingNum = "123476545" } + }; + try { - //expected exception; - registerTokenResponse rtokenResponse = litle.RegisterToken(registerTokenRequest); + _litle.RegisterToken(registerTokenRequest); + Assert.Fail("Exception expected!"); } catch (LitleOnlineException e) { @@ -112,11 +132,15 @@ public void TokenEcheckMissingRequiredField() [Test] public void TestSimpleTokenWithNullableTypeField() { - registerTokenRequestType registerTokenRequest = new registerTokenRequestType(); - registerTokenRequest.orderId = "12344"; - registerTokenRequest.accountNumber = "1233456789103801"; - registerTokenRequest.reportGroup = "Planets"; - registerTokenResponse rtokenResponse = litle.RegisterToken(registerTokenRequest); + var registerTokenRequest = new registerTokenRequestType + { + orderId = "12344", + accountNumber = "1233456789103801", + reportGroup = "Planets" + }; + + var rtokenResponse = _litle.RegisterToken(registerTokenRequest); + StringAssert.AreEqualIgnoringCase("Account number was successfully registered", rtokenResponse.message); Assert.IsNull(rtokenResponse.type); } diff --git a/LitleSdkForNet/LitleSdkForNetTest/Functional/TestUTF8.cs b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestUTF8.cs new file mode 100644 index 00000000..c5dcbbe3 --- /dev/null +++ b/LitleSdkForNet/LitleSdkForNetTest/Functional/TestUTF8.cs @@ -0,0 +1,62 @@ +using System.Collections.Generic; +using NUnit.Framework; + +namespace Litle.Sdk.Test.Functional +{ + [TestFixture] + internal class TestUTF8 + { + private LitleOnline _litle; + private Dictionary _config; + + [TestFixtureSetUp] + public void SetUpLitle() + { + _config = new Dictionary + { + {"url", "https://www.testlitle.com/sandbox/communicator/online"}, + {"reportGroup", "Default Report Group"}, + {"username", "BATCHSDKA"}, + {"version", "9.12"}, + {"timeout", "5000"}, + {"merchantId", "0180"}, + {"password", "certpass"}, + {"printxml", "true"}, + {"proxyHost", Properties.Settings.Default.proxyHost}, + {"proxyPort", Properties.Settings.Default.proxyPort}, + {"logFile", Properties.Settings.Default.logFile}, + {"neuterAccountNums", "true"} + }; + + _litle = new LitleOnline(_config); + } + + [Test] + public void SimpleAuthWithUnicode() + { + var authorization = new authorization + { + reportGroup = "русский中文", + orderId = "12344", + amount = 106, + orderSource = orderSourceType.ecommerce, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000000", + expDate = "1210" + }, + billToAddress = new contact + { + addressLine1 = "Planetsрусский中文", + zip = "01803-3747", + firstName = "vvantiv" + } + }; + + var response = _litle.Authorize(authorization); + Assert.AreEqual("русский中文", response.reportGroup); + } + + } +} diff --git a/LitleSdkForNet/LitleSdkForNetTest/LitleSdkForNetTest.csproj b/LitleSdkForNet/LitleSdkForNetTest/LitleSdkForNetTest.csproj index a99a3baa..271df81b 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/LitleSdkForNetTest.csproj +++ b/LitleSdkForNet/LitleSdkForNetTest/LitleSdkForNetTest.csproj @@ -1,186 +1,190 @@ - - - - Debug - x86 - 8.0.30703 - 2.0 - {D0A0B9E4-E555-498D-910D-28C61BD094EF} - Exe - Properties - Litle.Sdk.Test - LitleSdkForDotNetTest - v4.5 - - - 512 - false - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - true - - - x86 - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - x86 - pdbonly - true - bin\Debug\ - TRACE - prompt - 4 - false - - - - - - - ..\packages\Moq.4.2.1312.1622\lib\net35\Moq.dll - - - ..\packages\NUnitTestAdapter.1.0\lib\nunit.core.dll - False - - - ..\packages\NUnitTestAdapter.1.0\lib\nunit.core.interfaces.dll - False - - - ..\packages\NUnit.2.6.3\lib\nunit.framework.dll - - - ..\packages\NUnitTestAdapter.1.0\lib\nunit.util.dll - False - - - ..\packages\NUnitTestAdapter.1.0\lib\NUnit.VisualStudio.TestAdapter.dll - False - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Designer - - - Designer - - - - - False - Microsoft .NET Framework 4 Client Profile %28x86 and x64%29 - true - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - false - - - False - Windows Installer 3.1 - true - - - - - {4A6E3397-DE37-4F91-A90F-E74C1D91E098} - LitleSdkForNet - - - - - - - - - - + + + + Debug + x86 + 8.0.30703 + 2.0 + {D0A0B9E4-E555-498D-910D-28C61BD094EF} + Exe + Properties + Litle.Sdk.Test + LitleSdkForDotNetTest + v4.5 + + + 512 + false + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + true + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + x86 + pdbonly + true + bin\Debug\ + TRACE + prompt + 4 + false + + + + + + + ..\packages\Moq.4.2.1312.1622\lib\net35\Moq.dll + + + ..\packages\NUnitTestAdapter.1.0\lib\nunit.core.dll + False + + + ..\packages\NUnitTestAdapter.1.0\lib\nunit.core.interfaces.dll + False + + + ..\packages\NUnit.2.6.3\lib\nunit.framework.dll + + + ..\packages\NUnitTestAdapter.1.0\lib\nunit.util.dll + False + + + ..\packages\NUnitTestAdapter.1.0\lib\NUnit.VisualStudio.TestAdapter.dll + False + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Designer + + + Designer + + + + + False + Microsoft .NET Framework 4 Client Profile %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + false + + + False + Windows Installer 3.1 + true + + + + + {4A6E3397-DE37-4F91-A90F-E74C1D91E098} + LitleSdkForNet + + + + + + + + + + + --> \ No newline at end of file diff --git a/LitleSdkForNet/LitleSdkForNetTest/Unit/TestAdvancedFraudCheck.cs b/LitleSdkForNet/LitleSdkForNetTest/Unit/TestAdvancedFraudCheck.cs new file mode 100644 index 00000000..efffbb17 --- /dev/null +++ b/LitleSdkForNet/LitleSdkForNetTest/Unit/TestAdvancedFraudCheck.cs @@ -0,0 +1,166 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Moq; +using System.Text.RegularExpressions; + +namespace Litle.Sdk.Test.Unit +{ + [TestFixture] + class TestAdvancedFraudCheck + { + + private LitleOnline litle; + + [TestFixtureSetUp] + public void SetUpLitle() + { + litle = new LitleOnline(); + } + + [Test] + public void TestNoCustomAttributes() + { + fraudCheck fraudCheck = new fraudCheck(); + advancedFraudChecksType advancedFraudCheck = new advancedFraudChecksType(); + fraudCheck.advancedFraudChecks = advancedFraudCheck; + advancedFraudCheck.threatMetrixSessionId = "123"; + + var mock = new Mock(); + + mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*123\r\n.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("742802348034313000000Approvedpass42triggered_rule_default"); + + Communications mockedCommunication = mock.Object; + litle.setCommunication(mockedCommunication); + fraudCheckResponse fraudCheckResponse = litle.FraudCheck(fraudCheck); + + Assert.NotNull(fraudCheckResponse); + Assert.AreEqual("pass", fraudCheckResponse.advancedFraudResults.deviceReviewStatus); + } + + [Test] + public void TestCustomAttribute1() + { + fraudCheck fraudCheck = new fraudCheck(); + advancedFraudChecksType advancedFraudCheck = new advancedFraudChecksType(); + fraudCheck.advancedFraudChecks = advancedFraudCheck; + advancedFraudCheck.threatMetrixSessionId = "123"; + advancedFraudCheck.customAttribute1 = "abc"; + + var mock = new Mock(); + + mock.Setup(Communications => Communications.HttpPost(It.IsRegex("..*123\r\nabc\r\n.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("742802348034313000000Approvedpass42triggered_rule_default"); + + Communications mockedCommunication = mock.Object; + litle.setCommunication(mockedCommunication); + fraudCheckResponse fraudCheckResponse = litle.FraudCheck(fraudCheck); + + Assert.NotNull(fraudCheckResponse); + Assert.AreEqual(42, fraudCheckResponse.advancedFraudResults.deviceReputationScore); + } + + [Test] + public void TestCustomAttribute2() + { + fraudCheck fraudCheck = new fraudCheck(); + advancedFraudChecksType advancedFraudCheck = new advancedFraudChecksType(); + fraudCheck.advancedFraudChecks = advancedFraudCheck; + advancedFraudCheck.threatMetrixSessionId = "123"; + advancedFraudCheck.customAttribute1 = "abc"; + advancedFraudCheck.customAttribute2 = "def"; + + var mock = new Mock(); + + mock.Setup(Communications => Communications.HttpPost(It.IsRegex("..*123\r\nabc\r\ndef\r\n.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("742802348034313000000Approvedpass42triggered_rule_default"); + + Communications mockedCommunication = mock.Object; + litle.setCommunication(mockedCommunication); + fraudCheckResponse fraudCheckResponse = litle.FraudCheck(fraudCheck); + + Assert.NotNull(fraudCheckResponse); + Assert.AreEqual("triggered_rule_default", fraudCheckResponse.advancedFraudResults.triggeredRule); + } + + [Test] + public void TestCustomAttribute3() + { + fraudCheck fraudCheck = new fraudCheck(); + advancedFraudChecksType advancedFraudCheck = new advancedFraudChecksType(); + fraudCheck.advancedFraudChecks = advancedFraudCheck; + advancedFraudCheck.threatMetrixSessionId = "123"; + advancedFraudCheck.customAttribute1 = "abc"; + advancedFraudCheck.customAttribute2 = "def"; + advancedFraudCheck.customAttribute3 = "ghi"; + + var mock = new Mock(); + + mock.Setup(Communications => Communications.HttpPost(It.IsRegex("..*123\r\nabc\r\ndef\r\nghi\r\n.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("742802348034313000000Approvedpass42triggered_rule_default"); + + Communications mockedCommunication = mock.Object; + litle.setCommunication(mockedCommunication); + fraudCheckResponse fraudCheckResponse = litle.FraudCheck(fraudCheck); + + Assert.NotNull(fraudCheckResponse); + Assert.AreEqual("Approved", fraudCheckResponse.message); + } + + [Test] + public void TestCustomAttribute4() + { + fraudCheck fraudCheck = new fraudCheck(); + advancedFraudChecksType advancedFraudCheck = new advancedFraudChecksType(); + fraudCheck.advancedFraudChecks = advancedFraudCheck; + advancedFraudCheck.threatMetrixSessionId = "123"; + advancedFraudCheck.customAttribute1 = "abc"; + advancedFraudCheck.customAttribute2 = "def"; + advancedFraudCheck.customAttribute3 = "ghi"; + advancedFraudCheck.customAttribute4 = "jkl"; + + var mock = new Mock(); + + mock.Setup(Communications => Communications.HttpPost(It.IsRegex("..*123\r\nabc\r\ndef\r\nghi\r\njkl\r\n.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("742802348034313000000Approvedpass42triggered_rule_default"); + + Communications mockedCommunication = mock.Object; + litle.setCommunication(mockedCommunication); + fraudCheckResponse fraudCheckResponse = litle.FraudCheck(fraudCheck); + + Assert.NotNull(fraudCheckResponse); + Assert.AreEqual("000", fraudCheckResponse.response); + } + + [Test] + public void TestCustomAttribute5() + { + fraudCheck fraudCheck = new fraudCheck(); + advancedFraudChecksType advancedFraudCheck = new advancedFraudChecksType(); + fraudCheck.advancedFraudChecks = advancedFraudCheck; + advancedFraudCheck.threatMetrixSessionId = "123"; + advancedFraudCheck.customAttribute1 = "abc"; + advancedFraudCheck.customAttribute2 = "def"; + advancedFraudCheck.customAttribute3 = "ghi"; + advancedFraudCheck.customAttribute4 = "jkl"; + advancedFraudCheck.customAttribute5 = "mno"; + + var mock = new Mock(); + + mock.Setup(Communications => Communications.HttpPost(It.IsRegex("..*123\r\nabc\r\ndef\r\nghi\r\njkl\r\nmno\r\n.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("742802348034313000000Approvedpass42triggered_rule_default"); + + Communications mockedCommunication = mock.Object; + litle.setCommunication(mockedCommunication); + fraudCheckResponse fraudCheckResponse = litle.FraudCheck(fraudCheck); + + Assert.NotNull(fraudCheckResponse); + Assert.AreEqual(742802348034313000, fraudCheckResponse.litleTxnId); + } + + } +} diff --git a/LitleSdkForNet/LitleSdkForNetTest/Unit/TestAuthorization.cs b/LitleSdkForNet/LitleSdkForNetTest/Unit/TestAuthorization.cs index 55e41d41..708be722 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Unit/TestAuthorization.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Unit/TestAuthorization.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; using NUnit.Framework; -using Litle.Sdk; using Moq; using System.Text.RegularExpressions; @@ -10,35 +7,37 @@ namespace Litle.Sdk.Test.Unit { [TestFixture] - class TestAuthorization + internal class TestAuthorization { - private LitleOnline litle; + private LitleOnline _litle; [TestFixtureSetUp] public void SetUpLitle() { - litle = new LitleOnline(); + _litle = new LitleOnline(); } [Test] public void TestFraudFilterOverride() { - authorization auth = new authorization(); - auth.orderId = "12344"; - auth.amount = 2; - auth.orderSource = orderSourceType.ecommerce; - auth.reportGroup = "Planets"; - auth.fraudFilterOverride = true; + var auth = new authorization + { + orderId = "12344", + amount = 2, + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets", + fraudFilterOverride = true + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*true.*", RegexOptions.Singleline), It.IsAny>())) + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*true.*", RegexOptions.Singleline), It.IsAny>())) .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - authorizationResponse authorizationResponse = litle.Authorize(auth); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + var authorizationResponse = _litle.Authorize(auth); Assert.NotNull(authorizationResponse); Assert.AreEqual(123, authorizationResponse.litleTxnId); @@ -47,76 +46,85 @@ public void TestFraudFilterOverride() [Test] public void TestContactShouldSendEmailForEmail_NotZip() { - authorization auth = new authorization(); - auth.orderId = "12344"; - auth.amount = 2; - auth.orderSource = orderSourceType.ecommerce; - auth.reportGroup = "Planets"; - contact billToAddress = new contact(); - billToAddress.email = "gdake@litle.com"; - billToAddress.zip = "12345"; - auth.billToAddress = billToAddress; - + var auth = new authorization + { + orderId = "12344", + amount = 2, + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets", + billToAddress = new contact + { + email = "gdake@litle.com", + zip = "12345" + } + }; + var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*12345.*gdake@litle.com.*", RegexOptions.Singleline), It.IsAny>())) + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*12345.*gdake@litle.com.*", RegexOptions.Singleline), It.IsAny>())) .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - authorizationResponse authorizationResponse = litle.Authorize(auth); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + var authorizationResponse = _litle.Authorize(auth); Assert.NotNull(authorizationResponse); Assert.AreEqual(123, authorizationResponse.litleTxnId); } [Test] - public void Test3dsAttemptedShouldNotSayItem() + public void Test3DsAttemptedShouldNotSayItem() { - authorization auth = new authorization(); - auth.orderId = "12344"; - auth.amount = 2; - auth.orderSource = orderSourceType.item3dsAttempted; - auth.reportGroup = "Planets"; - contact billToAddress = new contact(); - billToAddress.email = "gdake@litle.com"; - billToAddress.zip = "12345"; - auth.billToAddress = billToAddress; - + var auth = new authorization + { + orderId = "12344", + amount = 2, + orderSource = orderSourceType.item3dsAttempted, + reportGroup = "Planets", + billToAddress = new contact + { + email = "gdake@litle.com", + zip = "12345" + } + }; + var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*2.*3dsAttempted.*", RegexOptions.Singleline), It.IsAny>())) + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2.*3dsAttempted.*", RegexOptions.Singleline), It.IsAny>())) .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - authorizationResponse authorizationResponse = litle.Authorize(auth); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + var authorizationResponse = _litle.Authorize(auth); Assert.NotNull(authorizationResponse); Assert.AreEqual(123, authorizationResponse.litleTxnId); } [Test] - public void Test3dsAuthenticatedShouldNotSayItem() + public void Test3DsAuthenticatedShouldNotSayItem() { - authorization auth = new authorization(); - auth.orderId = "12344"; - auth.amount = 2; - auth.orderSource = orderSourceType.item3dsAuthenticated; - auth.reportGroup = "Planets"; - contact billToAddress = new contact(); - billToAddress.email = "gdake@litle.com"; - billToAddress.zip = "12345"; - auth.billToAddress = billToAddress; - + var auth = new authorization + { + orderId = "12344", + amount = 2, + orderSource = orderSourceType.item3dsAuthenticated, + reportGroup = "Planets", + billToAddress = new contact + { + email = "gdake@litle.com", + zip = "12345" + } + }; + var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*2.*3dsAuthenticated.*", RegexOptions.Singleline), It.IsAny>())) + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2.*3dsAuthenticated.*", RegexOptions.Singleline), It.IsAny>())) .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - authorizationResponse authorizationResponse = litle.Authorize(auth); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + var authorizationResponse = _litle.Authorize(auth); Assert.NotNull(authorizationResponse); Assert.AreEqual(123, authorizationResponse.litleTxnId); @@ -125,21 +133,23 @@ public void Test3dsAuthenticatedShouldNotSayItem() [Test] public void TestSecondaryAmount() { - authorization auth = new authorization(); - auth.orderId = "12344"; - auth.amount = 2; - auth.secondaryAmount = 1; - auth.orderSource = orderSourceType.ecommerce; - auth.reportGroup = "Planets"; + var auth = new authorization + { + orderId = "12344", + amount = 2, + secondaryAmount = 1, + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets" + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*2\r\n1\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2\r\n1\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - authorizationResponse authorizationResponse = litle.Authorize(auth); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + var authorizationResponse = _litle.Authorize(auth); Assert.NotNull(authorizationResponse); Assert.AreEqual(123, authorizationResponse.litleTxnId); @@ -148,21 +158,23 @@ public void TestSecondaryAmount() [Test] public void TestSurchargeAmount() { - authorization auth = new authorization(); - auth.orderId = "12344"; - auth.amount = 2; - auth.surchargeAmount = 1; - auth.orderSource = orderSourceType.ecommerce; - auth.reportGroup = "Planets"; + var auth = new authorization + { + orderId = "12344", + amount = 2, + surchargeAmount = 1, + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets" + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*2\r\n1\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2\r\n1\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - authorizationResponse authorizationResponse = litle.Authorize(auth); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + var authorizationResponse = _litle.Authorize(auth); Assert.NotNull(authorizationResponse); Assert.AreEqual(123, authorizationResponse.litleTxnId); @@ -171,20 +183,22 @@ public void TestSurchargeAmount() [Test] public void TestSurchargeAmount_Optional() { - authorization auth = new authorization(); - auth.orderId = "12344"; - auth.amount = 2; - auth.orderSource = orderSourceType.ecommerce; - auth.reportGroup = "Planets"; + var auth = new authorization + { + orderId = "12344", + amount = 2, + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets" + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*2\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - authorizationResponse authorizationResponse = litle.Authorize(auth); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + var authorizationResponse = _litle.Authorize(auth); Assert.NotNull(authorizationResponse); Assert.AreEqual(123, authorizationResponse.litleTxnId); @@ -193,25 +207,29 @@ public void TestSurchargeAmount_Optional() [Test] public void TestMethodOfPaymentAllowsGiftCard() { - authorization auth = new authorization(); - auth.orderId = "12344"; - auth.amount = 2; - auth.orderSource = orderSourceType.ecommerce; - auth.reportGroup = "Planets"; - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.GC; - card.number = "414100000000000000"; - card.expDate = "1210"; - auth.card = card; - + var auth = new authorization + { + orderId = "12344", + amount = 2, + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets", + card = new cardType + { + type = methodOfPaymentTypeEnum.GC, + number = "414100000000000000", + expDate = "1210", + pin = "9876" + } + }; + var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*\r\nGC\r\n414100000000000000\r\n1210\r\n.*", RegexOptions.Singleline), It.IsAny>())) + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*\r\nGC\r\n414100000000000000\r\n1210\r\n9876\r\n.*", RegexOptions.Singleline), It.IsAny>())) .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - authorizationResponse authorizationResponse = litle.Authorize(auth); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + var authorizationResponse = _litle.Authorize(auth); Assert.NotNull(authorizationResponse); Assert.AreEqual(123, authorizationResponse.litleTxnId); @@ -220,35 +238,36 @@ public void TestMethodOfPaymentAllowsGiftCard() [Test] public void TestMethodOfPaymentApplepayAndWallet() { - authorization auth = new authorization(); - auth.orderId = "12344"; - auth.amount = 2; - auth.orderSource = orderSourceType.applepay; - auth.reportGroup = "Planets"; - applepayType applepay = new applepayType(); - applepayHeaderType applepayHeaderType = new applepayHeaderType(); - applepayHeaderType.applicationData = "454657413164"; - applepayHeaderType.ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; - applepayHeaderType.publicKeyHash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; - applepayHeaderType.transactionId = "1234"; - applepay.header = applepayHeaderType; - applepay.data = "user"; - applepay.signature = "sign"; - applepay.version = "1"; - auth.applepay = applepay; - - wallet wallet = new wallet(); - wallet.walletSourceTypeId = "123"; - auth.wallet = wallet; + var auth = new authorization + { + orderId = "12344", + amount = 2, + orderSource = orderSourceType.applepay, + reportGroup = "Planets", + applepay = new applepayType + { + data = "user", + signature = "sign", + version = "1", + header = new applepayHeaderType + { + applicationData = "454657413164", + ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + publicKeyHash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + transactionId = "1234" + } + }, + wallet = new wallet { walletSourceTypeId = "123" } + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?applepay.*?.*?user.*?.*?.*?123.*?.*?.*?", RegexOptions.Singleline), It.IsAny>())) + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*?applepay.*?.*?user.*?.*?.*?123.*?.*?.*?", RegexOptions.Singleline), It.IsAny>())) .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - authorizationResponse authorizationResponse = litle.Authorize(auth); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + var authorizationResponse = _litle.Authorize(auth); Assert.NotNull(authorizationResponse); Assert.AreEqual(123, authorizationResponse.litleTxnId); @@ -257,28 +276,36 @@ public void TestMethodOfPaymentApplepayAndWallet() [Test] public void TestRecurringRequest() { - authorization auth = new authorization(); - auth.card = new cardType(); - auth.card.type = methodOfPaymentTypeEnum.VI; - auth.card.number = "4100000000000001"; - auth.card.expDate = "1213"; - auth.orderId = "12344"; - auth.amount = 2; - auth.orderSource = orderSourceType.ecommerce; - auth.fraudFilterOverride = true; - auth.recurringRequest = new recurringRequest(); - auth.recurringRequest.subscription = new subscription(); - auth.recurringRequest.subscription.planCode = "abc123"; - auth.recurringRequest.subscription.numberOfPayments = 12; + var auth = new authorization + { + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000001", + expDate = "1213" + }, + orderId = "12344", + amount = 2, + orderSource = orderSourceType.ecommerce, + fraudFilterOverride = true, + recurringRequest = new recurringRequest + { + subscription = new subscription + { + planCode = "abc123", + numberOfPayments = 12 + } + } + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*true\r\n\r\n\r\nabc123\r\n12\r\n\r\n\r\n.*", RegexOptions.Singleline), It.IsAny>())) + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*true\r\n\r\n\r\nabc123\r\n12\r\n\r\n\r\n.*", RegexOptions.Singleline), It.IsAny>())) .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - authorizationResponse authorizationResponse = litle.Authorize(auth); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + var authorizationResponse = _litle.Authorize(auth); Assert.NotNull(authorizationResponse); Assert.AreEqual(123, authorizationResponse.litleTxnId); @@ -287,25 +314,29 @@ public void TestRecurringRequest() [Test] public void TestDebtRepayment() { - authorization auth = new authorization(); - auth.card = new cardType(); - auth.card.type = methodOfPaymentTypeEnum.VI; - auth.card.number = "4100000000000001"; - auth.card.expDate = "1213"; - auth.orderId = "12344"; - auth.amount = 2; - auth.orderSource = orderSourceType.ecommerce; - auth.fraudFilterOverride = true; - auth.debtRepayment = true; + var auth = new authorization + { + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000001", + expDate = "1213" + }, + orderId = "12344", + amount = 2, + orderSource = orderSourceType.ecommerce, + fraudFilterOverride = true, + debtRepayment = true + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*true\r\ntrue\r\n.*", RegexOptions.Singleline), It.IsAny>())) + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*true\r\ntrue\r\n.*", RegexOptions.Singleline), It.IsAny>())) .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - authorizationResponse authorizationResponse = litle.Authorize(auth); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + var authorizationResponse = _litle.Authorize(auth); Assert.NotNull(authorizationResponse); Assert.AreEqual(123, authorizationResponse.litleTxnId); @@ -314,9 +345,9 @@ public void TestDebtRepayment() [Test] public void TestRecurringResponse_Full() { - String xmlResponse = "12312345Foo678"; - litleOnlineResponse litleOnlineResponse = LitleOnline.DeserializeObject(xmlResponse); - authorizationResponse authorizationResponse = (authorizationResponse)litleOnlineResponse.authorizationResponse; + var xmlResponse = "12312345Foo678"; + var litleOnlineResponse = LitleOnline.DeserializeObject(xmlResponse); + var authorizationResponse = litleOnlineResponse.authorizationResponse; Assert.AreEqual(123, authorizationResponse.litleTxnId); Assert.AreEqual(12, authorizationResponse.recurringResponse.subscriptionId); @@ -328,9 +359,9 @@ public void TestRecurringResponse_Full() [Test] public void TestRecurringResponse_NoRecurringTxnId() { - String xmlResponse = "12312345Foo"; - litleOnlineResponse litleOnlineResponse = LitleOnline.DeserializeObject(xmlResponse); - authorizationResponse authorizationResponse = (authorizationResponse)litleOnlineResponse.authorizationResponse; + var xmlResponse = "12312345Foo"; + var litleOnlineResponse = LitleOnline.DeserializeObject(xmlResponse); + var authorizationResponse = litleOnlineResponse.authorizationResponse; Assert.AreEqual(123, authorizationResponse.litleTxnId); Assert.AreEqual(12, authorizationResponse.recurringResponse.subscriptionId); @@ -342,18 +373,21 @@ public void TestRecurringResponse_NoRecurringTxnId() [Test] public void TestSimpleAuthWithFraudCheck() { - authorization auth = new authorization(); - auth.card = new cardType(); - auth.card.type = methodOfPaymentTypeEnum.VI; - auth.card.number = "4100000000000001"; - auth.card.expDate = "1213"; - auth.orderId = "12344"; - auth.amount = 2; - auth.orderSource = orderSourceType.ecommerce; - auth.cardholderAuthentication = new fraudCheckType(); - auth.cardholderAuthentication.customerIpAddress = "192.168.1.1"; - - String expectedResult = @" + var auth = new authorization + { + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000001", + expDate = "1213" + }, + orderId = "12344", + amount = 2, + orderSource = orderSourceType.ecommerce, + cardholderAuthentication = new fraudCheckType {customerIpAddress = "192.168.1.1"} + }; + + const string expectedResult = @" 12344 2 @@ -371,14 +405,14 @@ public void TestSimpleAuthWithFraudCheck() Assert.AreEqual(expectedResult, auth.Serialize()); var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*.*192.168.1.1.*.*", RegexOptions.Singleline), It.IsAny>())) + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*.*192.168.1.1.*.*", RegexOptions.Singleline), It.IsAny>())) .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Authorize(auth); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Authorize(auth); - authorizationResponse authorizationResponse = litle.Authorize(auth); + var authorizationResponse = _litle.Authorize(auth); Assert.NotNull(authorizationResponse); Assert.AreEqual(123, authorizationResponse.litleTxnId); @@ -387,19 +421,25 @@ public void TestSimpleAuthWithFraudCheck() [Test] public void TestSimpleAuthWithBillMeLaterRequest() { - authorization auth = new authorization(); - auth.card = new cardType(); - auth.card.type = methodOfPaymentTypeEnum.VI; - auth.card.number = "4100000000000001"; - auth.card.expDate = "1213"; - auth.orderId = "12344"; - auth.amount = 2; - auth.orderSource = orderSourceType.ecommerce; - auth.billMeLaterRequest = new billMeLaterRequest(); - auth.billMeLaterRequest.virtualAuthenticationKeyData = "Data"; - auth.billMeLaterRequest.virtualAuthenticationKeyPresenceIndicator = "Presence"; - - String expectedResult = @" + var auth = new authorization + { + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000001", + expDate = "1213" + }, + orderId = "12344", + amount = 2, + orderSource = orderSourceType.ecommerce, + billMeLaterRequest = new billMeLaterRequest + { + virtualAuthenticationKeyData = "Data", + virtualAuthenticationKeyPresenceIndicator = "Presence" + } + }; + + const string expectedResult = @" 12344 2 @@ -418,14 +458,14 @@ public void TestSimpleAuthWithBillMeLaterRequest() Assert.AreEqual(expectedResult, auth.Serialize()); var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*.*\r\nPresence\r\nData\r\n.*.*", RegexOptions.Singleline), It.IsAny>())) + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*.*\r\nPresence\r\nData\r\n.*.*", RegexOptions.Singleline), It.IsAny>())) .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Authorize(auth); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Authorize(auth); - authorizationResponse authorizationResponse = litle.Authorize(auth); + var authorizationResponse = _litle.Authorize(auth); Assert.NotNull(authorizationResponse); Assert.AreEqual(123, authorizationResponse.litleTxnId); @@ -434,19 +474,23 @@ public void TestSimpleAuthWithBillMeLaterRequest() [Test] public void TestAuthWithAdvancedFraud() { - authorization auth = new authorization(); - auth.orderId = "123"; - auth.amount = 10; - auth.advancedFraudChecks = new advancedFraudChecksType(); - auth.advancedFraudChecks.threatMetrixSessionId = "800"; - auth.advancedFraudChecks.customAttribute1 = "testAttribute1"; - auth.advancedFraudChecks.customAttribute2 = "testAttribute2"; - auth.advancedFraudChecks.customAttribute3 = "testAttribute3"; - auth.advancedFraudChecks.customAttribute4 = "testAttribute4"; - auth.advancedFraudChecks.customAttribute5 = "testAttribute5"; - - - String expectedResult = @" + var auth = new authorization + { + orderId = "123", + amount = 10, + advancedFraudChecks = new advancedFraudChecksType + { + threatMetrixSessionId = "800", + customAttribute1 = "testAttribute1", + customAttribute2 = "testAttribute2", + customAttribute3 = "testAttribute3", + customAttribute4 = "testAttribute4", + customAttribute5 = "testAttribute5" + } + }; + + + const string expectedResult = @" 123 10 @@ -459,16 +503,16 @@ public void TestAuthWithAdvancedFraud() testAttribute5 "; - string test = auth.Serialize(); + Assert.AreEqual(expectedResult, auth.Serialize()); var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsAny(), It.IsAny>())) - .Returns("123\"ReviewStatus\"800"); + mock.Setup(communications => communications.HttpPost(It.IsAny(), It.IsAny>())) + .Returns("123\"ReviewStatus\"800"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - authorizationResponse authorizationResponse = litle.Authorize(auth); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + var authorizationResponse = _litle.Authorize(auth); Assert.NotNull(authorizationResponse); Assert.AreEqual("123", authorizationResponse.orderId); @@ -477,7 +521,7 @@ public void TestAuthWithAdvancedFraud() [Test] public void TestAdvancedFraudResponse() { - String xmlResponse = @" + const string xmlResponse = @" 123 @@ -485,13 +529,14 @@ public void TestAdvancedFraudResponse() ReviewStatus 800 rule triggered +rule triggered 2 "; - litleOnlineResponse litleOnlineResponse = LitleOnline.DeserializeObject(xmlResponse); - authorizationResponse authorizationResponse = (authorizationResponse)litleOnlineResponse.authorizationResponse; + var litleOnlineResponse = LitleOnline.DeserializeObject(xmlResponse); + var authorizationResponse = litleOnlineResponse.authorizationResponse; Assert.AreEqual(123, authorizationResponse.litleTxnId); @@ -507,13 +552,14 @@ public void TestAdvancedFraudResponse() [Test] public void TestAuthWithPosCatLevelEnum() { - authorization auth = new authorization(); - auth.pos = new pos(); - auth.orderId = "ABC123"; - auth.amount = 98700; - auth.pos.catLevel = posCatLevelEnum.selfservice; - - String expectedResult = @" + var auth = new authorization + { + pos = new pos{catLevel = posCatLevelEnum.selfservice }, + orderId = "ABC123", + amount = 98700 + }; + + const string expectedResult = @" ABC123 98700 @@ -525,12 +571,12 @@ public void TestAuthWithPosCatLevelEnum() Assert.AreEqual(expectedResult, auth.Serialize()); var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsAny(), It.IsAny>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsAny(), It.IsAny>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - authorizationResponse authorizationResponse = litle.Authorize(auth); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + var authorizationResponse = _litle.Authorize(auth); Assert.NotNull(authorizationResponse); Assert.AreEqual(123, authorizationResponse.litleTxnId); @@ -539,7 +585,7 @@ public void TestAuthWithPosCatLevelEnum() [Test] public void TestRecycleEngineActive() { - String xmlResponse = @" + const string xmlResponse = @" 123 @@ -555,8 +601,8 @@ public void TestRecycleEngineActive() "; - litleOnlineResponse litleOnlineResponse = LitleOnline.DeserializeObject(xmlResponse); - authorizationResponse authorizationResponse = (authorizationResponse)litleOnlineResponse.authorizationResponse; + var litleOnlineResponse = LitleOnline.DeserializeObject(xmlResponse); + var authorizationResponse = litleOnlineResponse.authorizationResponse; Assert.AreEqual(123, authorizationResponse.litleTxnId); @@ -570,5 +616,69 @@ public void TestRecycleEngineActive() Assert.AreEqual(true, authorizationResponse.recycling.recycleEngineActive); } + [Test] + public void TestAndroidpay() + { + var auth = new authorization + { + amount = 2, + secondaryAmount = 1, + orderSource = orderSourceType.androidpay, + reportGroup = "Planets" + }; + + var mock = new Mock(); + + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2\r\n1\r\nandroidpay.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123ApprovedaHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj1kUXc0dzlXZ1hjUQ0K012050"); + + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Authorize(auth); + } + + [Test] + public void TestOrigTxnIdAndOrigAmount() + { + var auth = new authorization + { + amount = 584, + orderSource = orderSourceType.ecommerce, + originalNetworkTransactionId = "1234567890123456978901234567890", + originalTransactionAmount = 6478, + reportGroup = "Planets" + }; + + var mock = new Mock(); + + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*584\r\necommerce\r\n1234567890123456978901234567890\r\n6478.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123>Approved"); + + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Authorize(auth); + } + + [Test] + public void TestProcessingType() + { + var auth = new authorization + { + amount = 584, + orderSource = orderSourceType.ecommerce, + processingType = processingType.initialInstallment, + reportGroup = "Planets" + }; + + var mock = new Mock(); + + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*584\r\necommerce\r\ninitialInstallment.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123>Approved"); + + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Authorize(auth); + } + } } diff --git a/LitleSdkForNet/LitleSdkForNetTest/Unit/TestBatchRequest.cs b/LitleSdkForNet/LitleSdkForNetTest/Unit/TestBatchRequest.cs index 34ae5c3f..3ee2039b 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Unit/TestBatchRequest.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Unit/TestBatchRequest.cs @@ -1,70 +1,62 @@ using System; using System.Collections.Generic; -using System.Text; using NUnit.Framework; -using Litle.Sdk; using Moq; -using System.Text.RegularExpressions; -using Moq.Language.Flow; - namespace Litle.Sdk.Test.Unit { [TestFixture] class TestBatchRequest { - private batchRequest batchRequest; - private const string timeFormat = "MM-dd-yyyy_HH-mm-ss-ffff_"; - private const string timeRegex = "[0-1][0-9]-[0-3][0-9]-[0-9]{4}_[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{4}_"; - private const string batchNameRegex = timeRegex + "[A-Z]{8}"; - private const string mockFileName = "TheRainbow.xml"; - private const string mockFilePath = "C:\\Somewhere\\\\Over\\\\" + mockFileName; + private batchRequest _batchRequest; + private const string MockFileName = "TheRainbow.xml"; + private const string MockFilePath = "C:\\Somewhere\\\\Over\\\\" + MockFileName; - private Mock mockLitleFile; - private Mock mockLitleTime; + private Mock _mockLitleFile; + private Mock _mockLitleTime; [TestFixtureSetUp] - public void setUp() + public void SetUp() { - mockLitleFile = new Mock(); - mockLitleTime = new Mock(); + _mockLitleFile = new Mock(); + _mockLitleTime = new Mock(); - mockLitleFile.Setup(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)).Returns(mockFilePath); - mockLitleFile.Setup(litleFile => litleFile.AppendLineToFile(mockFilePath, It.IsAny())).Returns(mockFilePath); + _mockLitleFile.Setup(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)).Returns(MockFilePath); + _mockLitleFile.Setup(litleFile => litleFile.AppendLineToFile(MockFilePath, It.IsAny())).Returns(MockFilePath); } [SetUp] - public void beforeTestSetup() + public void BeforeTestSetup() { - batchRequest = new batchRequest(); - batchRequest.setLitleFile(mockLitleFile.Object); - batchRequest.setLitleTime(mockLitleTime.Object); + _batchRequest = new batchRequest(); + _batchRequest.setLitleFile(_mockLitleFile.Object); + _batchRequest.setLitleTime(_mockLitleTime.Object); } [Test] - public void testBatchRequestContainsMerchantSdkAttribute() + public void TestBatchRequestContainsMerchantSdkAttribute() { - Dictionary mockConfig = new Dictionary(); + var mockConfig = new Dictionary(); mockConfig["merchantId"] = "01234"; mockConfig["requestDirectory"] = "C:\\MockRequests"; mockConfig["responseDirectory"] = "C:\\MockResponses"; - batchRequest = new batchRequest(mockConfig); + _batchRequest = new batchRequest(mockConfig); - String actual = batchRequest.generateXmlHeader(); - String expected = @" + var actual = _batchRequest.generateXmlHeader(); + const string expected = @" "; Assert.AreEqual(expected, actual); } [Test] - public void testInitialization() + public void TestInitialization() { - Dictionary mockConfig = new Dictionary(); + var mockConfig = new Dictionary(); mockConfig["url"] = "https://www.mockurl.com"; mockConfig["reportGroup"] = "Mock Report Group"; @@ -84,314 +76,314 @@ public void testInitialization() mockConfig["requestDirectory"] = "C:\\MockRequests"; mockConfig["responseDirectory"] = "C:\\MockResponses"; - batchRequest = new batchRequest(mockConfig); + _batchRequest = new batchRequest(mockConfig); - Assert.AreEqual("C:\\MockRequests\\Requests\\", batchRequest.getRequestDirectory()); - Assert.AreEqual("C:\\MockResponses\\Responses\\", batchRequest.getResponseDirectory()); + Assert.AreEqual("C:\\MockRequests\\Requests\\", _batchRequest.getRequestDirectory()); + Assert.AreEqual("C:\\MockResponses\\Responses\\", _batchRequest.getResponseDirectory()); - Assert.NotNull(batchRequest.getLitleTime()); - Assert.NotNull(batchRequest.getLitleFile()); + Assert.NotNull(_batchRequest.getLitleTime()); + Assert.NotNull(_batchRequest.getLitleFile()); } [Test] - public void testAddAuthorization() + public void TestAddAuthorization() { - authorization authorization = new authorization(); + var authorization = new authorization(); authorization.reportGroup = "Planets"; authorization.orderId = "12344"; authorization.amount = 106; authorization.orderSource = orderSourceType.ecommerce; - cardType card = new cardType(); + var card = new cardType(); card.type = methodOfPaymentTypeEnum.VI; card.number = "4100000000000002"; card.expDate = "1210"; authorization.card = card; - batchRequest.addAuthorization(authorization); + _batchRequest.addAuthorization(authorization); - Assert.AreEqual(1, batchRequest.getNumAuthorization()); - Assert.AreEqual(authorization.amount, batchRequest.getSumOfAuthorization()); + Assert.AreEqual(1, _batchRequest.getNumAuthorization()); + Assert.AreEqual(authorization.amount, _batchRequest.getSumOfAuthorization()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, authorization.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, authorization.Serialize())); } [Test] - public void testAddAccountUpdate() + public void TestAddAccountUpdate() { - accountUpdate accountUpdate = new accountUpdate(); + var accountUpdate = new accountUpdate(); accountUpdate.reportGroup = "Planets"; accountUpdate.orderId = "12344"; - cardType card = new cardType(); + var card = new cardType(); card.type = methodOfPaymentTypeEnum.VI; card.number = "4100000000000002"; card.expDate = "1210"; accountUpdate.card = card; - batchRequest.addAccountUpdate(accountUpdate); + _batchRequest.addAccountUpdate(accountUpdate); - Assert.AreEqual(1, batchRequest.getNumAccountUpdates()); + Assert.AreEqual(1, _batchRequest.getNumAccountUpdates()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, accountUpdate.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, accountUpdate.Serialize())); } [Test] - public void testAuthReversal() + public void TestAuthReversal() { - authReversal authreversal = new authReversal(); + var authreversal = new authReversal(); authreversal.litleTxnId = 12345678000; authreversal.amount = 106; authreversal.payPalNotes = "Notes"; - batchRequest.addAuthReversal(authreversal); + _batchRequest.addAuthReversal(authreversal); - Assert.AreEqual(1, batchRequest.getNumAuthReversal()); - Assert.AreEqual(authreversal.amount, batchRequest.getSumOfAuthReversal()); + Assert.AreEqual(1, _batchRequest.getNumAuthReversal()); + Assert.AreEqual(authreversal.amount, _batchRequest.getSumOfAuthReversal()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, authreversal.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, authreversal.Serialize())); } [Test] - public void testCapture() + public void TestCapture() { - capture capture = new capture(); + var capture = new capture(); capture.litleTxnId = 12345678000; capture.amount = 106; - batchRequest.addCapture(capture); + _batchRequest.addCapture(capture); - Assert.AreEqual(1, batchRequest.getNumCapture()); - Assert.AreEqual(capture.amount, batchRequest.getSumOfCapture()); + Assert.AreEqual(1, _batchRequest.getNumCapture()); + Assert.AreEqual(capture.amount, _batchRequest.getSumOfCapture()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, capture.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, capture.Serialize())); } [Test] - public void testCaptureGivenAuth() + public void TestCaptureGivenAuth() { - captureGivenAuth capturegivenauth = new captureGivenAuth(); + var capturegivenauth = new captureGivenAuth(); capturegivenauth.orderId = "12344"; capturegivenauth.amount = 106; - authInformation authinfo = new authInformation(); + var authinfo = new authInformation(); authinfo.authDate = new DateTime(2002, 10, 9); authinfo.authCode = "543216"; authinfo.authAmount = 12345; capturegivenauth.authInformation = authinfo; capturegivenauth.orderSource = orderSourceType.ecommerce; - cardType card = new cardType(); + var card = new cardType(); card.type = methodOfPaymentTypeEnum.VI; card.number = "4100000000000001"; card.expDate = "1210"; capturegivenauth.card = card; - batchRequest.addCaptureGivenAuth(capturegivenauth); + _batchRequest.addCaptureGivenAuth(capturegivenauth); - Assert.AreEqual(1, batchRequest.getNumCaptureGivenAuth()); - Assert.AreEqual(capturegivenauth.amount, batchRequest.getSumOfCaptureGivenAuth()); + Assert.AreEqual(1, _batchRequest.getNumCaptureGivenAuth()); + Assert.AreEqual(capturegivenauth.amount, _batchRequest.getSumOfCaptureGivenAuth()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, capturegivenauth.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, capturegivenauth.Serialize())); } [Test] - public void testCredit() + public void TestCredit() { - credit credit = new credit(); + var credit = new credit(); credit.orderId = "12344"; credit.amount = 106; credit.orderSource = orderSourceType.ecommerce; - cardType card = new cardType(); + var card = new cardType(); card.type = methodOfPaymentTypeEnum.VI; card.number = "4100000000000001"; card.expDate = "1210"; credit.card = card; - batchRequest.addCredit(credit); + _batchRequest.addCredit(credit); - Assert.AreEqual(1, batchRequest.getNumCredit()); - Assert.AreEqual(credit.amount, batchRequest.getSumOfCredit()); + Assert.AreEqual(1, _batchRequest.getNumCredit()); + Assert.AreEqual(credit.amount, _batchRequest.getSumOfCredit()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, credit.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, credit.Serialize())); } [Test] - public void testEcheckCredit() + public void TestEcheckCredit() { - echeckCredit echeckcredit = new echeckCredit(); + var echeckcredit = new echeckCredit(); echeckcredit.amount = 12; echeckcredit.litleTxnId = 123456789101112; - batchRequest.addEcheckCredit(echeckcredit); + _batchRequest.addEcheckCredit(echeckcredit); - Assert.AreEqual(1, batchRequest.getNumEcheckCredit()); - Assert.AreEqual(echeckcredit.amount, batchRequest.getSumOfEcheckCredit()); + Assert.AreEqual(1, _batchRequest.getNumEcheckCredit()); + Assert.AreEqual(echeckcredit.amount, _batchRequest.getSumOfEcheckCredit()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, echeckcredit.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, echeckcredit.Serialize())); } [Test] - public void testEcheckRedeposit() + public void TestEcheckRedeposit() { - echeckRedeposit echeckredeposit = new echeckRedeposit(); + var echeckredeposit = new echeckRedeposit(); echeckredeposit.litleTxnId = 123456; - batchRequest.addEcheckRedeposit(echeckredeposit); + _batchRequest.addEcheckRedeposit(echeckredeposit); - Assert.AreEqual(1, batchRequest.getNumEcheckRedeposit()); + Assert.AreEqual(1, _batchRequest.getNumEcheckRedeposit()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, echeckredeposit.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, echeckredeposit.Serialize())); } [Test] - public void testEcheckSale() + public void TestEcheckSale() { - echeckSale echecksale = new echeckSale(); + var echecksale = new echeckSale(); echecksale.orderId = "12345"; echecksale.amount = 123456; echecksale.orderSource = orderSourceType.ecommerce; - echeckType echeck = new echeckType(); + var echeck = new echeckType(); echeck.accType = echeckAccountTypeEnum.Checking; echeck.accNum = "12345657890"; echeck.routingNum = "123456789"; echeck.checkNum = "123455"; echecksale.echeck = echeck; - contact contact = new contact(); + var contact = new contact(); contact.name = "Bob"; contact.city = "lowell"; contact.state = "MA"; contact.email = "litle.com"; echecksale.billToAddress = contact; - batchRequest.addEcheckSale(echecksale); + _batchRequest.addEcheckSale(echecksale); - Assert.AreEqual(1, batchRequest.getNumEcheckSale()); - Assert.AreEqual(echecksale.amount, batchRequest.getSumOfEcheckSale()); + Assert.AreEqual(1, _batchRequest.getNumEcheckSale()); + Assert.AreEqual(echecksale.amount, _batchRequest.getSumOfEcheckSale()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, echecksale.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, echecksale.Serialize())); } [Test] - public void testEcheckVerification() + public void TestEcheckVerification() { - echeckVerification echeckverification = new echeckVerification(); + var echeckverification = new echeckVerification(); echeckverification.orderId = "12345"; echeckverification.amount = 123456; echeckverification.orderSource = orderSourceType.ecommerce; - echeckType echeck = new echeckType(); + var echeck = new echeckType(); echeck.accType = echeckAccountTypeEnum.Checking; echeck.accNum = "12345657890"; echeck.routingNum = "123456789"; echeck.checkNum = "123455"; echeckverification.echeck = echeck; - contact contact = new contact(); + var contact = new contact(); contact.name = "Bob"; contact.city = "lowell"; contact.state = "MA"; contact.email = "litle.com"; echeckverification.billToAddress = contact; - batchRequest.addEcheckVerification(echeckverification); + _batchRequest.addEcheckVerification(echeckverification); - Assert.AreEqual(1, batchRequest.getNumEcheckVerification()); - Assert.AreEqual(echeckverification.amount, batchRequest.getSumOfEcheckVerification()); + Assert.AreEqual(1, _batchRequest.getNumEcheckVerification()); + Assert.AreEqual(echeckverification.amount, _batchRequest.getSumOfEcheckVerification()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, echeckverification.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, echeckverification.Serialize())); } [Test] - public void testForceCapture() + public void TestForceCapture() { - forceCapture forcecapture = new forceCapture(); + var forcecapture = new forceCapture(); forcecapture.orderId = "12344"; forcecapture.amount = 106; forcecapture.orderSource = orderSourceType.ecommerce; - cardType card = new cardType(); + var card = new cardType(); card.type = methodOfPaymentTypeEnum.VI; card.number = "4100000000000001"; card.expDate = "1210"; forcecapture.card = card; - batchRequest.addForceCapture(forcecapture); + _batchRequest.addForceCapture(forcecapture); - Assert.AreEqual(1, batchRequest.getNumForceCapture()); - Assert.AreEqual(forcecapture.amount, batchRequest.getSumOfForceCapture()); + Assert.AreEqual(1, _batchRequest.getNumForceCapture()); + Assert.AreEqual(forcecapture.amount, _batchRequest.getSumOfForceCapture()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, forcecapture.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, forcecapture.Serialize())); } [Test] - public void testSale() + public void TestSale() { - sale sale = new sale(); + var sale = new sale(); sale.orderId = "12344"; sale.amount = 106; sale.orderSource = orderSourceType.ecommerce; - cardType card = new cardType(); + var card = new cardType(); card.type = methodOfPaymentTypeEnum.VI; card.number = "4100000000000002"; card.expDate = "1210"; sale.card = card; - batchRequest.addSale(sale); + _batchRequest.addSale(sale); - Assert.AreEqual(1, batchRequest.getNumSale()); - Assert.AreEqual(sale.amount, batchRequest.getSumOfSale()); + Assert.AreEqual(1, _batchRequest.getNumSale()); + Assert.AreEqual(sale.amount, _batchRequest.getSumOfSale()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, sale.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, sale.Serialize())); } [Test] - public void testToken() + public void TestToken() { - registerTokenRequestType token = new registerTokenRequestType(); + var token = new registerTokenRequestType(); token.orderId = "12344"; token.accountNumber = "1233456789103801"; - batchRequest.addRegisterTokenRequest(token); + _batchRequest.addRegisterTokenRequest(token); - Assert.AreEqual(1, batchRequest.getNumRegisterTokenRequest()); + Assert.AreEqual(1, _batchRequest.getNumRegisterTokenRequest()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, token.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, token.Serialize())); } [Test] - public void testUpdateCardValidationNumOnToken() + public void TestUpdateCardValidationNumOnToken() { - updateCardValidationNumOnToken updateCardValidationNumOnToken = new updateCardValidationNumOnToken(); + var updateCardValidationNumOnToken = new updateCardValidationNumOnToken(); updateCardValidationNumOnToken.orderId = "12344"; updateCardValidationNumOnToken.litleToken = "123"; - batchRequest.addUpdateCardValidationNumOnToken(updateCardValidationNumOnToken); + _batchRequest.addUpdateCardValidationNumOnToken(updateCardValidationNumOnToken); - Assert.AreEqual(1, batchRequest.getNumUpdateCardValidationNumOnToken()); + Assert.AreEqual(1, _batchRequest.getNumUpdateCardValidationNumOnToken()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, updateCardValidationNumOnToken.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, updateCardValidationNumOnToken.Serialize())); } [Test] - public void testUpdateSubscription() + public void TestUpdateSubscription() { - updateSubscription update = new updateSubscription(); + var update = new updateSubscription(); update.billingDate = new DateTime(2002, 10, 9); - contact billToAddress = new contact(); + var billToAddress = new contact(); billToAddress.name = "Greg Dake"; billToAddress.city = "Lowell"; billToAddress.state = "MA"; billToAddress.email = "sdksupport@litle.com"; update.billToAddress = billToAddress; - cardType card = new cardType(); + var card = new cardType(); card.number = "4100000000000001"; card.expDate = "1215"; card.type = methodOfPaymentTypeEnum.VI; @@ -399,385 +391,385 @@ public void testUpdateSubscription() update.planCode = "abcdefg"; update.subscriptionId = 12345; - batchRequest.addUpdateSubscription(update); + _batchRequest.addUpdateSubscription(update); - Assert.AreEqual(1, batchRequest.getNumUpdateSubscriptions()); + Assert.AreEqual(1, _batchRequest.getNumUpdateSubscriptions()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, update.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, update.Serialize())); } [Test] - public void testCreatePlan() + public void TestCreatePlan() { - createPlan createPlan = new createPlan(); + var createPlan = new createPlan(); - batchRequest.addCreatePlan(createPlan); + _batchRequest.addCreatePlan(createPlan); - Assert.AreEqual(1, batchRequest.getNumCreatePlans()); + Assert.AreEqual(1, _batchRequest.getNumCreatePlans()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, createPlan.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, createPlan.Serialize())); } [Test] - public void testUpdatePlan() + public void TestUpdatePlan() { - updatePlan updatePlan = new updatePlan(); + var updatePlan = new updatePlan(); - batchRequest.addUpdatePlan(updatePlan); + _batchRequest.addUpdatePlan(updatePlan); - Assert.AreEqual(1, batchRequest.getNumUpdatePlans()); + Assert.AreEqual(1, _batchRequest.getNumUpdatePlans()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, updatePlan.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, updatePlan.Serialize())); } [Test] - public void testActivate() + public void TestActivate() { - activate activate = new activate(); + var activate = new activate(); activate.amount = 500; activate.orderSource = orderSourceType.ecommerce; activate.card = new cardType(); - batchRequest.addActivate(activate); + _batchRequest.addActivate(activate); - Assert.AreEqual(1, batchRequest.getNumActivates()); - Assert.AreEqual(500, batchRequest.getActivateAmount()); + Assert.AreEqual(1, _batchRequest.getNumActivates()); + Assert.AreEqual(500, _batchRequest.getActivateAmount()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, activate.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, activate.Serialize())); } [Test] - public void testDeactivate() + public void TestDeactivate() { - deactivate deactivate = new deactivate(); + var deactivate = new deactivate(); deactivate.orderSource = orderSourceType.ecommerce; deactivate.card = new cardType(); - batchRequest.addDeactivate(deactivate); + _batchRequest.addDeactivate(deactivate); - Assert.AreEqual(1, batchRequest.getNumDeactivates()); + Assert.AreEqual(1, _batchRequest.getNumDeactivates()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, deactivate.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, deactivate.Serialize())); } [Test] - public void testLoad() + public void TestLoad() { - load load = new load(); + var load = new load(); load.amount = 600; load.orderSource = orderSourceType.ecommerce; load.card = new cardType(); - batchRequest.addLoad(load); + _batchRequest.addLoad(load); - Assert.AreEqual(1, batchRequest.getNumLoads()); - Assert.AreEqual(600, batchRequest.getLoadAmount()); + Assert.AreEqual(1, _batchRequest.getNumLoads()); + Assert.AreEqual(600, _batchRequest.getLoadAmount()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, load.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, load.Serialize())); } [Test] - public void testUnload() + public void TestUnload() { - unload unload = new unload(); + var unload = new unload(); unload.amount = 700; unload.orderSource = orderSourceType.ecommerce; unload.card = new cardType(); - batchRequest.addUnload(unload); + _batchRequest.addUnload(unload); - Assert.AreEqual(1, batchRequest.getNumUnloads()); - Assert.AreEqual(700, batchRequest.getUnloadAmount()); + Assert.AreEqual(1, _batchRequest.getNumUnloads()); + Assert.AreEqual(700, _batchRequest.getUnloadAmount()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, unload.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, unload.Serialize())); } [Test] - public void testBalanceInquiry() + public void TestBalanceInquiry() { - balanceInquiry balanceInquiry = new balanceInquiry(); + var balanceInquiry = new balanceInquiry(); balanceInquiry.orderSource = orderSourceType.ecommerce; balanceInquiry.card = new cardType(); - batchRequest.addBalanceInquiry(balanceInquiry); + _batchRequest.addBalanceInquiry(balanceInquiry); - Assert.AreEqual(1, batchRequest.getNumBalanceInquiries()); + Assert.AreEqual(1, _batchRequest.getNumBalanceInquiries()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, balanceInquiry.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, balanceInquiry.Serialize())); } [Test] - public void testCancelSubscription() + public void TestCancelSubscription() { - cancelSubscription cancel = new cancelSubscription(); + var cancel = new cancelSubscription(); cancel.subscriptionId = 12345; - batchRequest.addCancelSubscription(cancel); + _batchRequest.addCancelSubscription(cancel); - Assert.AreEqual(1, batchRequest.getNumCancelSubscriptions()); + Assert.AreEqual(1, _batchRequest.getNumCancelSubscriptions()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, cancel.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, cancel.Serialize())); } [Test] - public void testAddEcheckPreNoteSale() + public void TestAddEcheckPreNoteSale() { - echeckPreNoteSale echeckPreNoteSale = new echeckPreNoteSale(); + var echeckPreNoteSale = new echeckPreNoteSale(); echeckPreNoteSale.orderId = "12345"; echeckPreNoteSale.orderSource = orderSourceType.ecommerce; - echeckType echeck = new echeckType(); + var echeck = new echeckType(); echeck.accType = echeckAccountTypeEnum.Checking; echeck.accNum = "12345657890"; echeck.routingNum = "123456789"; echeck.checkNum = "123455"; echeckPreNoteSale.echeck = echeck; - contact contact = new contact(); + var contact = new contact(); contact.name = "Bob"; contact.city = "lowell"; contact.state = "MA"; contact.email = "litle.com"; echeckPreNoteSale.billToAddress = contact; - batchRequest.addEcheckPreNoteSale(echeckPreNoteSale); + _batchRequest.addEcheckPreNoteSale(echeckPreNoteSale); - Assert.AreEqual(1, batchRequest.getNumEcheckPreNoteSale()); + Assert.AreEqual(1, _batchRequest.getNumEcheckPreNoteSale()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, echeckPreNoteSale.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, echeckPreNoteSale.Serialize())); } [Test] - public void testAddEcheckPreNoteCredit() + public void TestAddEcheckPreNoteCredit() { - echeckPreNoteCredit echeckPreNoteCredit = new echeckPreNoteCredit(); + var echeckPreNoteCredit = new echeckPreNoteCredit(); echeckPreNoteCredit.orderId = "12345"; echeckPreNoteCredit.orderSource = orderSourceType.ecommerce; - echeckType echeck = new echeckType(); + var echeck = new echeckType(); echeck.accType = echeckAccountTypeEnum.Checking; echeck.accNum = "12345657890"; echeck.routingNum = "123456789"; echeck.checkNum = "123455"; echeckPreNoteCredit.echeck = echeck; - contact contact = new contact(); + var contact = new contact(); contact.name = "Bob"; contact.city = "lowell"; contact.state = "MA"; contact.email = "litle.com"; echeckPreNoteCredit.billToAddress = contact; - batchRequest.addEcheckPreNoteCredit(echeckPreNoteCredit); + _batchRequest.addEcheckPreNoteCredit(echeckPreNoteCredit); - Assert.AreEqual(1, batchRequest.getNumEcheckPreNoteCredit()); + Assert.AreEqual(1, _batchRequest.getNumEcheckPreNoteCredit()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, echeckPreNoteCredit.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, echeckPreNoteCredit.Serialize())); } [Test] - public void testAddSubmerchantCredit() + public void TestAddSubmerchantCredit() { - submerchantCredit submerchantCredit = new submerchantCredit(); + var submerchantCredit = new submerchantCredit(); submerchantCredit.fundingSubmerchantId = "123456"; submerchantCredit.submerchantName = "merchant"; submerchantCredit.fundsTransferId = "123467"; submerchantCredit.amount = 106L; - echeckType echeck = new echeckType(); + var echeck = new echeckType(); echeck.accType = echeckAccountTypeEnum.Checking; echeck.accNum = "12345657890"; echeck.routingNum = "123456789"; echeck.checkNum = "123455"; submerchantCredit.accountInfo = echeck; - batchRequest.addSubmerchantCredit(submerchantCredit); + _batchRequest.addSubmerchantCredit(submerchantCredit); - Assert.AreEqual(1, batchRequest.getNumSubmerchantCredit()); - Assert.AreEqual(106L, batchRequest.getSubmerchantCreditAmount()); + Assert.AreEqual(1, _batchRequest.getNumSubmerchantCredit()); + Assert.AreEqual(106L, _batchRequest.getSubmerchantCreditAmount()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, submerchantCredit.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, submerchantCredit.Serialize())); } [Test] - public void testAddPayFacCredit() + public void TestAddPayFacCredit() { - payFacCredit payFacCredit = new payFacCredit(); + var payFacCredit = new payFacCredit(); payFacCredit.fundingSubmerchantId = "123456"; payFacCredit.fundsTransferId = "123467"; payFacCredit.amount = 107L; - batchRequest.addPayFacCredit(payFacCredit); + _batchRequest.addPayFacCredit(payFacCredit); - Assert.AreEqual(1, batchRequest.getNumPayFacCredit()); - Assert.AreEqual(107L, batchRequest.getPayFacCreditAmount()); + Assert.AreEqual(1, _batchRequest.getNumPayFacCredit()); + Assert.AreEqual(107L, _batchRequest.getPayFacCreditAmount()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, payFacCredit.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, payFacCredit.Serialize())); } [Test] - public void testAddReserveCredit() + public void TestAddReserveCredit() { - reserveCredit reserveCredit = new reserveCredit(); + var reserveCredit = new reserveCredit(); reserveCredit.fundingSubmerchantId = "123456"; reserveCredit.fundsTransferId = "123467"; reserveCredit.amount = 107L; - batchRequest.addReserveCredit(reserveCredit); + _batchRequest.addReserveCredit(reserveCredit); - Assert.AreEqual(1, batchRequest.getNumReserveCredit()); - Assert.AreEqual(107L, batchRequest.getReserveCreditAmount()); + Assert.AreEqual(1, _batchRequest.getNumReserveCredit()); + Assert.AreEqual(107L, _batchRequest.getReserveCreditAmount()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, reserveCredit.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, reserveCredit.Serialize())); } [Test] - public void testAddVendorCredit() + public void TestAddVendorCredit() { - vendorCredit vendorCredit = new vendorCredit(); + var vendorCredit = new vendorCredit(); vendorCredit.fundingSubmerchantId = "123456"; vendorCredit.vendorName = "merchant"; vendorCredit.fundsTransferId = "123467"; vendorCredit.amount = 106L; - echeckType echeck = new echeckType(); + var echeck = new echeckType(); echeck.accType = echeckAccountTypeEnum.Checking; echeck.accNum = "12345657890"; echeck.routingNum = "123456789"; echeck.checkNum = "123455"; vendorCredit.accountInfo = echeck; - batchRequest.addVendorCredit(vendorCredit); + _batchRequest.addVendorCredit(vendorCredit); - Assert.AreEqual(1, batchRequest.getNumVendorCredit()); - Assert.AreEqual(106L, batchRequest.getVendorCreditAmount()); + Assert.AreEqual(1, _batchRequest.getNumVendorCredit()); + Assert.AreEqual(106L, _batchRequest.getVendorCreditAmount()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, vendorCredit.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, vendorCredit.Serialize())); } [Test] - public void testAddPhysicalCheckCredit() + public void TestAddPhysicalCheckCredit() { - physicalCheckCredit physicalCheckCredit = new physicalCheckCredit(); + var physicalCheckCredit = new physicalCheckCredit(); physicalCheckCredit.fundingSubmerchantId = "123456"; physicalCheckCredit.fundsTransferId = "123467"; physicalCheckCredit.amount = 107L; - batchRequest.addPhysicalCheckCredit(physicalCheckCredit); + _batchRequest.addPhysicalCheckCredit(physicalCheckCredit); - Assert.AreEqual(1, batchRequest.getNumPhysicalCheckCredit()); - Assert.AreEqual(107L, batchRequest.getPhysicalCheckCreditAmount()); + Assert.AreEqual(1, _batchRequest.getNumPhysicalCheckCredit()); + Assert.AreEqual(107L, _batchRequest.getPhysicalCheckCreditAmount()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, physicalCheckCredit.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, physicalCheckCredit.Serialize())); } [Test] - public void testAddSubmerchantDebit() + public void TestAddSubmerchantDebit() { - submerchantDebit submerchantDebit = new submerchantDebit(); + var submerchantDebit = new submerchantDebit(); submerchantDebit.fundingSubmerchantId = "123456"; submerchantDebit.submerchantName = "merchant"; submerchantDebit.fundsTransferId = "123467"; submerchantDebit.amount = 106L; - echeckType echeck = new echeckType(); + var echeck = new echeckType(); echeck.accType = echeckAccountTypeEnum.Checking; echeck.accNum = "12345657890"; echeck.routingNum = "123456789"; echeck.checkNum = "123455"; submerchantDebit.accountInfo = echeck; - batchRequest.addSubmerchantDebit(submerchantDebit); + _batchRequest.addSubmerchantDebit(submerchantDebit); - Assert.AreEqual(1, batchRequest.getNumSubmerchantDebit()); - Assert.AreEqual(106L, batchRequest.getSubmerchantDebitAmount()); + Assert.AreEqual(1, _batchRequest.getNumSubmerchantDebit()); + Assert.AreEqual(106L, _batchRequest.getSubmerchantDebitAmount()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, submerchantDebit.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, submerchantDebit.Serialize())); } [Test] - public void testAddPayFacDebit() + public void TestAddPayFacDebit() { - payFacDebit payFacDebit = new payFacDebit(); + var payFacDebit = new payFacDebit(); payFacDebit.fundingSubmerchantId = "123456"; payFacDebit.fundsTransferId = "123467"; payFacDebit.amount = 107L; - batchRequest.addPayFacDebit(payFacDebit); + _batchRequest.addPayFacDebit(payFacDebit); - Assert.AreEqual(1, batchRequest.getNumPayFacDebit()); - Assert.AreEqual(107L, batchRequest.getPayFacDebitAmount()); + Assert.AreEqual(1, _batchRequest.getNumPayFacDebit()); + Assert.AreEqual(107L, _batchRequest.getPayFacDebitAmount()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, payFacDebit.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, payFacDebit.Serialize())); } [Test] - public void testAddReserveDebit() + public void TestAddReserveDebit() { - reserveDebit reserveDebit = new reserveDebit(); + var reserveDebit = new reserveDebit(); reserveDebit.fundingSubmerchantId = "123456"; reserveDebit.fundsTransferId = "123467"; reserveDebit.amount = 107L; - batchRequest.addReserveDebit(reserveDebit); + _batchRequest.addReserveDebit(reserveDebit); - Assert.AreEqual(1, batchRequest.getNumReserveDebit()); - Assert.AreEqual(107L, batchRequest.getReserveDebitAmount()); + Assert.AreEqual(1, _batchRequest.getNumReserveDebit()); + Assert.AreEqual(107L, _batchRequest.getReserveDebitAmount()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, reserveDebit.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, reserveDebit.Serialize())); } [Test] - public void testAddVendorDebit() + public void TestAddVendorDebit() { - vendorDebit vendorDebit = new vendorDebit(); + var vendorDebit = new vendorDebit(); vendorDebit.fundingSubmerchantId = "123456"; vendorDebit.vendorName = "merchant"; vendorDebit.fundsTransferId = "123467"; vendorDebit.amount = 106L; - echeckType echeck = new echeckType(); + var echeck = new echeckType(); echeck.accType = echeckAccountTypeEnum.Checking; echeck.accNum = "12345657890"; echeck.routingNum = "123456789"; echeck.checkNum = "123455"; vendorDebit.accountInfo = echeck; - batchRequest.addVendorDebit(vendorDebit); + _batchRequest.addVendorDebit(vendorDebit); - Assert.AreEqual(1, batchRequest.getNumVendorDebit()); - Assert.AreEqual(106L, batchRequest.getVendorDebitAmount()); + Assert.AreEqual(1, _batchRequest.getNumVendorDebit()); + Assert.AreEqual(106L, _batchRequest.getVendorDebitAmount()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, vendorDebit.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, vendorDebit.Serialize())); } [Test] - public void testAddPhysicalCheckDebit() + public void TestAddPhysicalCheckDebit() { - physicalCheckDebit physicalCheckDebit = new physicalCheckDebit(); + var physicalCheckDebit = new physicalCheckDebit(); physicalCheckDebit.fundingSubmerchantId = "123456"; physicalCheckDebit.fundsTransferId = "123467"; physicalCheckDebit.amount = 107L; - batchRequest.addPhysicalCheckDebit(physicalCheckDebit); + _batchRequest.addPhysicalCheckDebit(physicalCheckDebit); - Assert.AreEqual(1, batchRequest.getNumPhysicalCheckDebit()); - Assert.AreEqual(107L, batchRequest.getPhysicalCheckDebitAmount()); + Assert.AreEqual(1, _batchRequest.getNumPhysicalCheckDebit()); + Assert.AreEqual(107L, _batchRequest.getPhysicalCheckDebitAmount()); - mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), mockLitleTime.Object)); - mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, physicalCheckDebit.Serialize())); + _mockLitleFile.Verify(litleFile => litleFile.createRandomFile(It.IsAny(), It.IsAny(), It.IsAny(), _mockLitleTime.Object)); + _mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(MockFilePath, physicalCheckDebit.Serialize())); } } } diff --git a/LitleSdkForNet/LitleSdkForNetTest/Unit/TestCapture.cs b/LitleSdkForNet/LitleSdkForNetTest/Unit/TestCapture.cs index 7680c89b..63ed2bdd 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Unit/TestCapture.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Unit/TestCapture.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; using NUnit.Framework; -using Litle.Sdk; using Moq; using System.Text.RegularExpressions; @@ -10,55 +7,79 @@ namespace Litle.Sdk.Test.Unit { [TestFixture] - class TestCapture + internal class TestCapture { - private LitleOnline litle; + private LitleOnline _litle; [TestFixtureSetUp] public void SetUpLitle() { - litle = new LitleOnline(); + _litle = new LitleOnline(); } [Test] public void TestSurchargeAmount() { - capture capture = new capture(); - capture.litleTxnId = 3; - capture.amount = 2; - capture.surchargeAmount = 1; - capture.payPalNotes = "note"; - capture.reportGroup = "Planets"; + var capture = new capture + { + litleTxnId = 3, + amount = 2, + surchargeAmount = 1, + payPalNotes = "note", + reportGroup = "Planets" + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*2\r\n1\r\nnote.*", RegexOptions.Singleline), It.IsAny>())) + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2\r\n1\r\nnote.*", RegexOptions.Singleline), It.IsAny>())) .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Capture(capture); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Capture(capture); } [Test] public void TestSurchargeAmount_Optional() { - capture capture = new capture(); - capture.litleTxnId = 3; - capture.amount = 2; - capture.payPalNotes = "note"; - capture.reportGroup = "Planets"; + var capture = new capture + { + litleTxnId = 3, + amount = 2, + payPalNotes = "note", + reportGroup = "Planets" + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*2\r\nnote.*", RegexOptions.Singleline), It.IsAny>())) + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2\r\nnote.*", RegexOptions.Singleline), It.IsAny>())) .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Capture(capture); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Capture(capture); } + [Test] + public void TestCapture_withPin() + { + var capture = new capture + { + litleTxnId = 3, + amount = 2, + reportGroup = "Planets", + pin = "1234" + }; + + var mock = new Mock(); + + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2\r\n1234.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); + + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Capture(capture); + } } } diff --git a/LitleSdkForNet/LitleSdkForNetTest/Unit/TestCaptureGivenAuth.cs b/LitleSdkForNet/LitleSdkForNetTest/Unit/TestCaptureGivenAuth.cs index cf688073..fb3cd697 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Unit/TestCaptureGivenAuth.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Unit/TestCaptureGivenAuth.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; using NUnit.Framework; -using Litle.Sdk; using Moq; using System.Text.RegularExpressions; @@ -10,121 +7,193 @@ namespace Litle.Sdk.Test.Unit { [TestFixture] - class TestCaptureGivenAuth + internal class TestCaptureGivenAuth { - private LitleOnline litle; + private LitleOnline _litle; [TestFixtureSetUp] - public void SetUpLitle() + public void SetUp() { - litle = new LitleOnline(); + _litle = new LitleOnline(); } [Test] public void TestSecondaryAmount() { - captureGivenAuth capture = new captureGivenAuth(); - capture.amount = 2; - capture.secondaryAmount = 1; - capture.orderSource = orderSourceType.ecommerce; - capture.reportGroup = "Planets"; + var capture = new captureGivenAuth + { + amount = 2, + secondaryAmount = 1, + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets" + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*2\r\n1\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2\r\n1\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.CaptureGivenAuth(capture); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.CaptureGivenAuth(capture); } [Test] public void TestSurchargeAmount() { - captureGivenAuth capture = new captureGivenAuth(); - capture.amount = 2; - capture.surchargeAmount = 1; - capture.orderSource = orderSourceType.ecommerce; - capture.reportGroup = "Planets"; + var capture = new captureGivenAuth + { + amount = 2, + surchargeAmount = 1, + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets" + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*2\r\n1\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2\r\n1\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.CaptureGivenAuth(capture); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.CaptureGivenAuth(capture); } [Test] public void TestSurchargeAmount_Optional() { - captureGivenAuth capture = new captureGivenAuth(); - capture.amount = 2; - capture.orderSource = orderSourceType.ecommerce; - capture.reportGroup = "Planets"; + var capture = new captureGivenAuth + { + amount = 2, + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets" + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*2\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.CaptureGivenAuth(capture); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.CaptureGivenAuth(capture); } [Test] public void TestDebtRepayment_True() { - captureGivenAuth captureGivenAuth = new captureGivenAuth(); - captureGivenAuth.merchantData = new merchantDataType(); - captureGivenAuth.debtRepayment = true; + var captureGivenAuth = new captureGivenAuth + { + merchantData = new merchantDataType(), + debtRepayment = true + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*\r\ntrue\r\n.*", RegexOptions.Singleline), It.IsAny>())) + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*\r\ntrue\r\n.*", RegexOptions.Singleline), It.IsAny>())) .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.CaptureGivenAuth(captureGivenAuth); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.CaptureGivenAuth(captureGivenAuth); } [Test] public void TestDebtRepayment_False() { - captureGivenAuth captureGivenAuth = new captureGivenAuth(); - captureGivenAuth.merchantData = new merchantDataType(); - captureGivenAuth.debtRepayment = false; + var captureGivenAuth = new captureGivenAuth + { + merchantData = new merchantDataType(), + debtRepayment = false + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*\r\nfalse\r\n.*", RegexOptions.Singleline), It.IsAny>())) + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*\r\nfalse\r\n.*", RegexOptions.Singleline), It.IsAny>())) .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.CaptureGivenAuth(captureGivenAuth); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.CaptureGivenAuth(captureGivenAuth); } [Test] public void TestDebtRepayment_Optional() { - captureGivenAuth captureGivenAuth = new captureGivenAuth(); - captureGivenAuth.merchantData = new merchantDataType(); + var captureGivenAuth = new captureGivenAuth {merchantData = new merchantDataType()}; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*\r\n.*", RegexOptions.Singleline), It.IsAny>())) + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*\r\n.*", RegexOptions.Singleline), It.IsAny>())) .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.CaptureGivenAuth(captureGivenAuth); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.CaptureGivenAuth(captureGivenAuth); + } + + [Test] + public void TestProcessingType() + { + var capture = new captureGivenAuth + { + amount = 2, + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets", + processingType = processingType.initialRecurring + }; + + var mock = new Mock(); + + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2\r\necommerce\r\ninitialRecurring.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); + + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.CaptureGivenAuth(capture); + } + + [Test] + public void TestOrigNetworkTxnId() + { + var capture = new captureGivenAuth + { + amount = 2, + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets", + originalNetworkTransactionId = "1234567890" + }; + + var mock = new Mock(); + + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2\r\necommerce\r\n1234567890.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); + + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.CaptureGivenAuth(capture); + } + + [Test] + public void TestOrigTxnAmount() + { + var capture = new captureGivenAuth + { + amount = 2, + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets", + originalTransactionAmount = 1066 + }; + + var mock = new Mock(); + + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2\r\necommerce\r\n1066.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); + + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.CaptureGivenAuth(capture); } } diff --git a/LitleSdkForNet/LitleSdkForNetTest/Unit/TestCommunications.cs b/LitleSdkForNet/LitleSdkForNetTest/Unit/TestCommunications.cs index c686b795..216c02fa 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Unit/TestCommunications.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Unit/TestCommunications.cs @@ -1,33 +1,26 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; using NUnit.Framework; -using Litle.Sdk; -using Moq; -using System.Text.RegularExpressions; namespace Litle.Sdk.Test.Unit { [TestFixture] - class TestCommunications + internal class TestCommunications { - private Communications objectUnderTest; + private Communications _objectUnderTest; [TestFixtureSetUp] public void SetUpLitle() { - objectUnderTest = new Communications(); + _objectUnderTest = new Communications(); } [Test] public void TestSettingProxyPropertiesToNullShouldTurnOffProxy() { - Dictionary config = new Dictionary(); - config.Add("proxyHost", null); - config.Add("proxyPort", null); + var config = new Dictionary {{"proxyHost", null}, {"proxyPort", null}}; - Assert.IsFalse(objectUnderTest.isProxyOn(config)); + Assert.IsFalse(_objectUnderTest.IsProxyOn(config)); } diff --git a/LitleSdkForNet/LitleSdkForNetTest/Unit/TestCredit.cs b/LitleSdkForNet/LitleSdkForNetTest/Unit/TestCredit.cs index e9c3c495..3cfb7e9d 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Unit/TestCredit.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Unit/TestCredit.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; -using System.Text; using NUnit.Framework; -using Litle.Sdk; using Moq; using System.Text.RegularExpressions; @@ -10,214 +8,277 @@ namespace Litle.Sdk.Test.Unit { [TestFixture] - class TestCredit + internal class TestCredit { - private LitleOnline litle; + private LitleOnline _litle; [TestFixtureSetUp] public void SetUpLitle() { - litle = new LitleOnline(); + _litle = new LitleOnline(); } [Test] public void TestActionReasonOnOrphanedRefund() { - credit credit = new credit(); - credit.orderId = "12344"; - credit.amount = 2; - credit.orderSource = orderSourceType.ecommerce; - credit.reportGroup = "Planets"; - credit.actionReason = "SUSPECT_FRAUD"; - + var credit = new credit + { + orderId = "12344", + amount = 2, + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets", + actionReason = "SUSPECT_FRAUD" + }; + var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*SUSPECT_FRAUD.*", RegexOptions.Singleline), It.IsAny>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*SUSPECT_FRAUD.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Credit(credit); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Credit(credit); } [Test] public void TestOrderSource_Set() { - credit credit = new credit(); - credit.orderId = "12344"; - credit.amount = 2; - credit.orderSource = orderSourceType.ecommerce; - credit.reportGroup = "Planets"; + var credit = new credit + { + orderId = "12344", + amount = 2, + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets" + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*2.*ecommerce.*.*", RegexOptions.Singleline), It.IsAny>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2.*ecommerce.*.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Credit(credit); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Credit(credit); } [Test] public void TestSecondaryAmount_Orphan() { - credit credit = new credit(); - credit.amount = 2; - credit.secondaryAmount = 1; - credit.orderId = "3"; - credit.orderSource = orderSourceType.ecommerce; - credit.reportGroup = "Planets"; + var credit = new credit + { + amount = 2, + secondaryAmount = 1, + orderId = "3", + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets" + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*3\r\n2\r\n1\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*3\r\n2\r\n1\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Credit(credit); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Credit(credit); } [Test] public void TestSecondaryAmount_Tied() { - credit credit = new credit(); - credit.amount = 2; - credit.secondaryAmount = 1; - credit.litleTxnId = 3; - credit.processingInstructions = new processingInstructions(); - credit.reportGroup = "Planets"; + var credit = new credit + { + amount = 2, + secondaryAmount = 1, + litleTxnId = 3, + processingInstructions = new processingInstructions(), + reportGroup = "Planets" + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*3\r\n2\r\n1\r\n>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*3\r\n2\r\n1\r\n>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Credit(credit); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Credit(credit); } [Test] public void TestSurchargeAmount_Tied() { - credit credit = new credit(); - credit.amount = 2; - credit.surchargeAmount = 1; - credit.litleTxnId = 3; - credit.processingInstructions = new processingInstructions(); - credit.reportGroup = "Planets"; + var credit = new credit + { + amount = 2, + surchargeAmount = 1, + litleTxnId = 3, + processingInstructions = new processingInstructions(), + reportGroup = "Planets" + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*3\r\n2\r\n1\r\n>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*3\r\n2\r\n1\r\n>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Credit(credit); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Credit(credit); } [Test] public void TestSurchargeAmount_TiedOptional() { - credit credit = new credit(); - credit.amount = 2; - credit.litleTxnId = 3; - credit.reportGroup = "Planets"; - credit.processingInstructions = new processingInstructions(); + var credit = new credit + { + amount = 2, + litleTxnId = 3, + reportGroup = "Planets", + processingInstructions = new processingInstructions() + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*3\r\n2\r\n>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*3\r\n2\r\n>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Credit(credit); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Credit(credit); } [Test] public void TestSurchargeAmount_Orphan() { - credit credit = new credit(); - credit.amount = 2; - credit.surchargeAmount = 1; - credit.orderId = "3"; - credit.orderSource = orderSourceType.ecommerce; - credit.reportGroup = "Planets"; + var credit = new credit + { + amount = 2, + surchargeAmount = 1, + orderId = "3", + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets" + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*3\r\n2\r\n1\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*3\r\n2\r\n1\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Credit(credit); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Credit(credit); } [Test] public void TestSurchargeAmount_OrphanOptional() { - credit credit = new credit(); - credit.amount = 2; - credit.orderId = "3"; - credit.orderSource = orderSourceType.ecommerce; - credit.reportGroup = "Planets"; + var credit = new credit + { + amount = 2, + orderId = "3", + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets" + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*3\r\n2\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*3\r\n2\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Credit(credit); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Credit(credit); } [Test] public void TestPos_Tied() { - credit credit = new credit(); - credit.amount = 2; - credit.pos = new pos(); - credit.pos.terminalId = "abc123"; - credit.litleTxnId = 3; - credit.reportGroup = "Planets"; - credit.payPalNotes = "notes"; + var credit = new credit + { + amount = 2, + pos = new pos {terminalId = "abc123"}, + litleTxnId = 3, + reportGroup = "Planets", + payPalNotes = "notes" + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*3\r\n2\r\n\r\nabc123\r\n.*", RegexOptions.Singleline), It.IsAny>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*3\r\n2\r\n\r\nabc123\r\n.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Credit(credit); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Credit(credit); } [Test] public void TestPos_TiedOptional() { - credit credit = new credit(); - credit.amount = 2; - credit.litleTxnId = 3; - credit.reportGroup = "Planets"; - credit.payPalNotes = "notes"; + var credit = new credit + { + amount = 2, + litleTxnId = 3, + reportGroup = "Planets", + payPalNotes = "notes" + }; + + var mock = new Mock(); + + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*3\r\n2\r\n.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); + + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Credit(credit); + } + + [Test] + public void TestCredit_withPin() + { + var credit = new credit + { + litleTxnId = 55, + orderId = "12344", + amount = 2, + reportGroup = "Planets", + pin = "1234" + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*3\r\n2\r\n.*", RegexOptions.Singleline), It.IsAny>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2.*\r\n1234.*.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Credit(credit); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Credit(credit); } + [Test] + public void TestCredit_withPinNotSent() + { + var credit = new credit + { + orderId = "12344", + amount = 2, + reportGroup = "Planets", + orderSource = orderSourceType.ecommerce, + // w/o a litleTxnId we should not send the pin element + pin = "1234" + }; + + var mock = new Mock(); + + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2.*\r\necommerce.*.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); + + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Credit(credit); + } } } diff --git a/LitleSdkForNet/LitleSdkForNetTest/Unit/TestEcheckVoid.cs b/LitleSdkForNet/LitleSdkForNetTest/Unit/TestEcheckVoid.cs index 15451541..59e3df36 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Unit/TestEcheckVoid.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Unit/TestEcheckVoid.cs @@ -37,21 +37,5 @@ public void TestFraudFilterOverride() litle.EcheckVoid(echeckVoid); } - [Test] - public void simpleForceCaptureWithSecondaryAmount() - { - forceCapture forcecapture = new forceCapture(); - forcecapture.amount = 106; - forcecapture.secondaryAmount = 50; - forcecapture.orderId = "12344"; - forcecapture.orderSource = orderSourceType.ecommerce; - cardType card = new cardType(); - card.type = methodOfPaymentTypeEnum.VI; - card.number = "4100000000000001"; - card.expDate = "1210"; - forcecapture.card = card; - forceCaptureResponse response = litle.ForceCapture(forcecapture); - Assert.AreEqual("Approved", response.message); - } } } diff --git a/LitleSdkForNet/LitleSdkForNetTest/Unit/TestForceCapture.cs b/LitleSdkForNet/LitleSdkForNetTest/Unit/TestForceCapture.cs index 6badfb32..a60dcadf 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Unit/TestForceCapture.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Unit/TestForceCapture.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; using NUnit.Framework; -using Litle.Sdk; using Moq; using System.Text.RegularExpressions; @@ -10,125 +7,153 @@ namespace Litle.Sdk.Test.Unit { [TestFixture] - class TestForceCapture + internal class TestForceCapture { - private LitleOnline litle; + private LitleOnline _litle; [TestFixtureSetUp] public void SetUpLitle() { - litle = new LitleOnline(); + _litle = new LitleOnline(); } [Test] public void TestSecondaryAmount() { - forceCapture capture = new forceCapture(); - capture.amount = 2; - capture.secondaryAmount = 1; - capture.orderSource = orderSourceType.ecommerce; - capture.reportGroup = "Planets"; + var capture = new forceCapture + { + amount = 2, + secondaryAmount = 1, + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets" + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*2\r\n1\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2\r\n1\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.ForceCapture(capture); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.ForceCapture(capture); } [Test] public void TestSurchargeAmount() { - forceCapture capture = new forceCapture(); - capture.amount = 2; - capture.surchargeAmount = 1; - capture.orderSource = orderSourceType.ecommerce; - capture.reportGroup = "Planets"; + var capture = new forceCapture + { + amount = 2, + surchargeAmount = 1, + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets" + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*2\r\n1\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2\r\n1\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.ForceCapture(capture); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.ForceCapture(capture); } [Test] public void TestSurchargeAmount_Optional() { - forceCapture capture = new forceCapture(); - capture.amount = 2; - capture.orderSource = orderSourceType.ecommerce; - capture.reportGroup = "Planets"; + var capture = new forceCapture + { + amount = 2, + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets" + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*2\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.ForceCapture(capture); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.ForceCapture(capture); } [Test] public void TestDebtRepayment_True() { - forceCapture forceCapture = new forceCapture(); - forceCapture.merchantData = new merchantDataType(); - forceCapture.debtRepayment = true; + var forceCapture = new forceCapture + { + merchantData = new merchantDataType(), + debtRepayment = true + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*\r\ntrue\r\n.*", RegexOptions.Singleline), It.IsAny>())) + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*\r\ntrue\r\n.*", RegexOptions.Singleline), It.IsAny>())) .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.ForceCapture(forceCapture); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.ForceCapture(forceCapture); } [Test] public void TestDebtRepayment_False() { - forceCapture forceCapture = new forceCapture(); - forceCapture.merchantData = new merchantDataType(); - forceCapture.debtRepayment = false; + var forceCapture = new forceCapture + { + merchantData = new merchantDataType(), + debtRepayment = false + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*\r\nfalse\r\n.*", RegexOptions.Singleline), It.IsAny>())) + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*\r\nfalse\r\n.*", RegexOptions.Singleline), It.IsAny>())) .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.ForceCapture(forceCapture); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.ForceCapture(forceCapture); } [Test] public void TestDebtRepayment_Optional() { - forceCapture forceCapture = new forceCapture(); - forceCapture.merchantData = new merchantDataType(); + var forceCapture = new forceCapture {merchantData = new merchantDataType()}; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*\r\n.*", RegexOptions.Singleline), It.IsAny>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*\r\n.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.ForceCapture(forceCapture); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.ForceCapture(forceCapture); } + [Test] + public void TestForceCapture_withProcessingType() + { + var capture = new forceCapture + { + amount = 2, + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets", + processingType = processingType.initialRecurring + }; + var mock = new Mock(); + + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2\r\necommerce\r\ninitialRecurring.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); + + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.ForceCapture(capture); + } } } diff --git a/LitleSdkForNet/LitleSdkForNetTest/Unit/TestRegisterTokenRequest.cs b/LitleSdkForNet/LitleSdkForNetTest/Unit/TestRegisterTokenRequest.cs index 8d071f98..229126da 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Unit/TestRegisterTokenRequest.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Unit/TestRegisterTokenRequest.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; using NUnit.Framework; -using Litle.Sdk; using Moq; using System.Text.RegularExpressions; @@ -10,77 +7,85 @@ namespace Litle.Sdk.Test.Unit { [TestFixture] - class TestRegisterTokenRequest + internal class TestRegisterTokenRequest { - private LitleOnline litle; + private LitleOnline _litle; [TestFixtureSetUp] public void SetUpLitle() { - litle = new LitleOnline(); + _litle = new LitleOnline(); } [Test] public void TestSimpleRequest() { - registerTokenRequestType register = new registerTokenRequestType(); - register.orderId = "12344"; - register.accountNumber = "4100000000000001"; - + var register = new registerTokenRequestType + { + orderId = "12344", + accountNumber = "4100000000000001" + }; + var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*4100000000000001.*.*", RegexOptions.Singleline), It.IsAny>())) - .Returns("4801Token Successfully Registered2012-10-10T10:17:03"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*4100000000000001.*.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("4801Token Successfully Registered2012-10-10T10:17:03"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.RegisterToken(register); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.RegisterToken(register); } [Test] public void TestCanContainCardValidationNum() { - registerTokenRequestType register = new registerTokenRequestType(); - register.orderId = "12344"; - register.accountNumber = "4100000000000001"; - register.cardValidationNum = "123"; + var register = new registerTokenRequestType + { + orderId = "12344", + accountNumber = "4100000000000001", + cardValidationNum = "123" + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*4100000000000001.*123.*.*", RegexOptions.Singleline), It.IsAny>())) - .Returns("4801Token Successfully Registered2012-10-10T10:17:03"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*4100000000000001.*123.*.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("4801Token Successfully Registered2012-10-10T10:17:03"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.RegisterToken(register); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.RegisterToken(register); } [Test] public void TestSimpleRequestWithApplepay() { - registerTokenRequestType register = new registerTokenRequestType(); - register.orderId = "12344"; - applepayType applepay = new applepayType(); - applepayHeaderType applepayHeaderType = new applepayHeaderType(); - applepayHeaderType.applicationData = "454657413164"; - applepayHeaderType.ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; - applepayHeaderType.publicKeyHash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; - applepayHeaderType.transactionId = "1234"; - applepay.header = applepayHeaderType; - applepay.data = "user"; - applepay.signature = "sign"; - applepay.version = "1"; - register.applepay = applepay; + var register = new registerTokenRequestType + { + orderId = "12344", + applepay = new applepayType + { + data = "user", + signature = "sign", + version = "1", + header = new applepayHeaderType + { + applicationData = "454657413164", + ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + publicKeyHash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + transactionId = "1234" + } + } + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*.*?user.*?.*?.*", RegexOptions.Singleline), It.IsAny>())) - .Returns("4801Token Successfully Registered2012-10-10T10:17:03"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*.*?user.*?.*?.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("4801Token Successfully Registered2012-10-10T10:17:03"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.RegisterToken(register); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.RegisterToken(register); } } diff --git a/LitleSdkForNet/LitleSdkForNetTest/Unit/TestSale.cs b/LitleSdkForNet/LitleSdkForNetTest/Unit/TestSale.cs index b3d5019b..04e44ace 100644 --- a/LitleSdkForNet/LitleSdkForNetTest/Unit/TestSale.cs +++ b/LitleSdkForNet/LitleSdkForNetTest/Unit/TestSale.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; using NUnit.Framework; -using Litle.Sdk; using Moq; using System.Text.RegularExpressions; @@ -10,106 +7,120 @@ namespace Litle.Sdk.Test.Unit { [TestFixture] - class TestSale + internal class TestSale { - private LitleOnline litle; + private LitleOnline _litle; [TestFixtureSetUp] public void SetUpLitle() { - litle = new LitleOnline(); + _litle = new LitleOnline(); } [Test] public void TestFraudFilterOverride() { - sale sale = new sale(); - sale.orderId = "12344"; - sale.amount = 2; - sale.orderSource = orderSourceType.ecommerce; - sale.reportGroup = "Planets"; - sale.fraudFilterOverride = false; - + var sale = new sale + { + orderId = "12344", + amount = 2, + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets", + fraudFilterOverride = false + }; + var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*false.*", RegexOptions.Singleline), It.IsAny>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*false.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Sale(sale); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Sale(sale); } [Test] public void TestSurchargeAmount() { - sale sale = new sale(); - sale.amount = 2; - sale.surchargeAmount = 1; - sale.orderSource = orderSourceType.ecommerce; - sale.reportGroup = "Planets"; + var sale = new sale + { + amount = 2, + surchargeAmount = 1, + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets" + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*2\r\n1\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2\r\n1\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Sale(sale); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Sale(sale); } [Test] public void TestSurchargeAmount_Optional() { - sale sale = new sale(); - sale.amount = 2; - sale.orderSource = orderSourceType.ecommerce; - sale.reportGroup = "Planets"; + var sale = new sale + { + amount = 2, + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets" + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*2\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Sale(sale); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Sale(sale); } [Test] public void TestRecurringRequest() { - sale sale = new sale(); - sale.card = new cardType(); - sale.card.type = methodOfPaymentTypeEnum.VI; - sale.card.number = "4100000000000001"; - sale.card.expDate = "1213"; - sale.orderId = "12344"; - sale.amount = 2; - sale.orderSource = orderSourceType.ecommerce; - sale.fraudFilterOverride = true; - sale.recurringRequest = new recurringRequest(); - sale.recurringRequest.subscription = new subscription(); - sale.recurringRequest.subscription.planCode = "abc123"; - sale.recurringRequest.subscription.numberOfPayments = 12; + var sale = new sale + { + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000001", + expDate = "1213" + }, + orderId = "12344", + amount = 2, + orderSource = orderSourceType.ecommerce, + fraudFilterOverride = true, + recurringRequest = new recurringRequest + { + subscription = new subscription + { + planCode = "abc123", + numberOfPayments = 12 + } + } + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*true\r\n\r\n\r\nabc123\r\n12\r\n\r\n.*", RegexOptions.Singleline), It.IsAny>())) + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*true\r\n\r\n\r\nabc123\r\n12\r\n\r\n.*", RegexOptions.Singleline), It.IsAny>())) .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Sale(sale); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Sale(sale); } [Test] public void TestRecurringResponse_Full() { - String xmlResponse = "12312345Foo678"; - litleOnlineResponse litleOnlineResponse = LitleOnline.DeserializeObject(xmlResponse); - saleResponse saleResponse = (saleResponse)litleOnlineResponse.saleResponse; + const string xmlResponse = "12312345Foo678"; + var litleOnlineResponse = LitleOnline.DeserializeObject(xmlResponse); + var saleResponse = litleOnlineResponse.saleResponse; Assert.AreEqual(123, saleResponse.litleTxnId); Assert.AreEqual(12, saleResponse.recurringResponse.subscriptionId); @@ -121,9 +132,9 @@ public void TestRecurringResponse_Full() { [Test] public void TestRecurringResponse_NoRecurringTxnId() { - String xmlResponse = "12312345Foo"; - litleOnlineResponse litleOnlineResponse = LitleOnline.DeserializeObject(xmlResponse); - saleResponse saleResponse = (saleResponse)litleOnlineResponse.saleResponse; + const string xmlResponse = "12312345Foo"; + var litleOnlineResponse = LitleOnline.DeserializeObject(xmlResponse); + var saleResponse = litleOnlineResponse.saleResponse; Assert.AreEqual(123, saleResponse.litleTxnId); Assert.AreEqual(12, saleResponse.recurringResponse.subscriptionId); @@ -135,153 +146,173 @@ public void TestRecurringResponse_NoRecurringTxnId() [Test] public void TestRecurringRequest_Optional() { - sale sale = new sale(); - sale.card = new cardType(); - sale.card.type = methodOfPaymentTypeEnum.VI; - sale.card.number = "4100000000000001"; - sale.card.expDate = "1213"; - sale.orderId = "12344"; - sale.amount = 2; - sale.orderSource = orderSourceType.ecommerce; - sale.fraudFilterOverride = true; + var sale = new sale + { + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000001", + expDate = "1213" + }, + orderId = "12344", + amount = 2, + orderSource = orderSourceType.ecommerce, + fraudFilterOverride = true + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*true\r\n.*", RegexOptions.Singleline), It.IsAny>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*true\r\n.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Sale(sale); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Sale(sale); } [Test] public void Test_LitleInternalRecurringRequest() { - sale sale = new sale(); - sale.card = new cardType(); - sale.card.type = methodOfPaymentTypeEnum.VI; - sale.card.number = "4100000000000001"; - sale.card.expDate = "1213"; - sale.orderId = "12344"; - sale.amount = 2; - sale.orderSource = orderSourceType.ecommerce; - sale.fraudFilterOverride = true; - sale.litleInternalRecurringRequest = new litleInternalRecurringRequest(); - sale.litleInternalRecurringRequest.subscriptionId = "123"; - sale.litleInternalRecurringRequest.recurringTxnId = "456"; + var sale = new sale + { + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000001", + expDate = "1213" + }, + orderId = "12344", + amount = 2, + orderSource = orderSourceType.ecommerce, + fraudFilterOverride = true, + litleInternalRecurringRequest = new litleInternalRecurringRequest + { + subscriptionId = "123", + recurringTxnId = "456" + } + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex("true\r\n\r\n123\r\n456\r\n.*", RegexOptions.Singleline), It.IsAny>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex("true\r\n\r\n123\r\n456\r\n.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Sale(sale); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Sale(sale); } public void Test_LitleInternalRecurringRequest_Optional() { - sale sale = new sale(); - sale.card = new cardType(); - sale.card.type = methodOfPaymentTypeEnum.VI; - sale.card.number = "4100000000000001"; - sale.card.expDate = "1213"; - sale.orderId = "12344"; - sale.amount = 2; - sale.orderSource = orderSourceType.ecommerce; - sale.fraudFilterOverride = true; + var sale = new sale + { + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000001", + expDate = "1213" + }, + orderId = "12344", + amount = 2, + orderSource = orderSourceType.ecommerce, + fraudFilterOverride = true + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*true\r\n.*", RegexOptions.Singleline), It.IsAny>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*true\r\n.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Sale(sale); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Sale(sale); } [Test] public void TestDebtRepayment_True() { - sale sale = new sale(); - sale.litleInternalRecurringRequest = new litleInternalRecurringRequest(); - sale.debtRepayment = true; + var sale = new sale + { + litleInternalRecurringRequest = new litleInternalRecurringRequest(), + debtRepayment = true + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*\r\ntrue\r\n.*", RegexOptions.Singleline), It.IsAny>())) + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*\r\ntrue\r\n.*", RegexOptions.Singleline), It.IsAny>())) .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Sale(sale); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Sale(sale); } [Test] public void TestDebtRepayment_False() { - sale sale = new sale(); - sale.litleInternalRecurringRequest = new litleInternalRecurringRequest(); - sale.debtRepayment = false; + var sale = new sale + { + litleInternalRecurringRequest = new litleInternalRecurringRequest(), + debtRepayment = false + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*\r\nfalse\r\n.*", RegexOptions.Singleline), It.IsAny>())) + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*\r\nfalse\r\n.*", RegexOptions.Singleline), It.IsAny>())) .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Sale(sale); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Sale(sale); } [Test] public void TestDebtRepayment_Optional() { - sale sale = new sale(); - sale.litleInternalRecurringRequest = new litleInternalRecurringRequest(); + var sale = new sale {litleInternalRecurringRequest = new litleInternalRecurringRequest()}; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*\r\n.*", RegexOptions.Singleline), It.IsAny>())) + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*\r\n.*", RegexOptions.Singleline), It.IsAny>())) .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Sale(sale); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Sale(sale); } [Test] public void TestSecondaryAmount() { - sale sale = new sale(); - sale.amount = 2; - sale.secondaryAmount = 1; - sale.orderSource = orderSourceType.ecommerce; - sale.reportGroup = "Planets"; + var sale = new sale + { + amount = 2, + secondaryAmount = 1, + orderSource = orderSourceType.ecommerce, + reportGroup = "Planets" + }; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*2\r\n1\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2\r\n1\r\necommerce.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Sale(sale); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Sale(sale); } [Test] public void TestApplepayAndWallet() { - sale sale = new sale(); - sale.applepay = new applepayType(); - applepayHeaderType applepayHeaderType = new applepayHeaderType(); - applepayHeaderType.applicationData = "454657413164"; - applepayHeaderType.ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; - applepayHeaderType.publicKeyHash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; - applepayHeaderType.transactionId = "1234"; + var sale = new sale {applepay = new applepayType()}; + var applepayHeaderType = new applepayHeaderType + { + applicationData = "454657413164", + ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + publicKeyHash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + transactionId = "1234" + }; sale.applepay.header = applepayHeaderType; sale.applepay.data = "user"; sale.applepay.signature = "sign"; @@ -289,18 +320,81 @@ public void TestApplepayAndWallet() sale.orderId = "12344"; sale.amount = 2; sale.orderSource = orderSourceType.ecommerce; - wallet wallet = new Sdk.wallet(); - wallet.walletSourceTypeId = "123"; + var wallet = new wallet {walletSourceTypeId = "123"}; sale.wallet = wallet; var mock = new Mock(); - mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?.*?user.*?.*?123.*?.*?.*?", RegexOptions.Singleline), It.IsAny>())) - .Returns("123"); + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*?.*?user.*?.*?123.*?.*?.*?", RegexOptions.Singleline), It.IsAny>())) + .Returns("123"); + + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Sale(sale); + } + + [Test] + public void TestAndroidpay() + { + var sale = new sale + { + amount = 2, + secondaryAmount = 1, + orderSource = orderSourceType.androidpay, + reportGroup = "Planets" + }; + + var mock = new Mock(); + + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*2\r\n1\r\nandroidpay.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123ApprovedaHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj1kUXc0dzlXZ1hjUQ0K012050"); + + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Sale(sale); + } + + [Test] + public void TestOrigTxnIdAndOrigAmount() + { + var sale = new sale + { + amount = 584, + orderSource = orderSourceType.ecommerce, + originalNetworkTransactionId = "1234567890123456978901234567890", + originalTransactionAmount = 6478, + reportGroup = "Planets" + }; + + var mock = new Mock(); + + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*584\r\necommerce\r\n1234567890123456978901234567890\r\n6478.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123>Approved"); + + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Sale(sale); + } + + [Test] + public void TestProcessingType() + { + var sale = new sale + { + amount = 584, + orderSource = orderSourceType.ecommerce, + processingType = processingType.initialInstallment, + reportGroup = "Planets" + }; + + var mock = new Mock(); + + mock.Setup(communications => communications.HttpPost(It.IsRegex(".*584\r\necommerce\r\ninitialInstallment.*", RegexOptions.Singleline), It.IsAny>())) + .Returns("123>Approved"); - Communications mockedCommunication = mock.Object; - litle.setCommunication(mockedCommunication); - litle.Sale(sale); + var mockedCommunication = mock.Object; + _litle.setCommunication(mockedCommunication); + _litle.Sale(sale); } } } diff --git a/README.md b/README.md index ee0570f5..857f0ce7 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,24 @@ -Litle Online .NET SDK +Vantiv eCommerce .NET SDK ===================== -About Litle +About Vantiv eCommerce ------------ -[Litle & Co.](http://www.litle.com) powers the payment processing engines for leading companies that sell directly to consumers through internet retail, direct response marketing (TV, radio and telephone), and online services. Litle & Co. is the leading, independent authority in card-not-present (CNP) commerce, transaction processing and merchant services. +[Vantiv eCommerce](https://developer.vantiv.com/community/ecommerce) powers the payment processing engines for leading companies that sell directly to consumers through internet retail, direct response marketing (TV, radio and telephone), and online services. Vantiv eCommerce is the leading authority in card-not-present (CNP) commerce, transaction processing and merchant services. About this SDK -------------- -The Litle .NET SDK is a C# implementation of the [Litle & Co.](http://www.litle.com) XML API. This SDK was created to make it as easy as possible to connect and process your payments with Litle. This SDK utilizes the HTTPS protocol to securely connect to Litle. Using the SDK requires coordination with the Litle team in order to be provided with credentials for accessing our systems. +The Vantiv eCommerce .NET SDK is a C# implementation of the [Vantiv eCommerce](https://developer.vantiv.com/community/ecommerce) XML API. This SDK was created to make it as easy as possible to connect and process your payments with Vantiv eCommerce. This SDK utilizes the HTTPS protocol to securely connect to Vantiv eCommerce. Using the SDK requires coordination with the Vantiv eCommerce team in order to be provided with credentials for accessing our systems. -Our .NET SDK supports all of the functionality present in Litle XML v8. Please see the online copy of our XSD for Litle XML to get more details on what is supported by the Litle payments engine. +Each .NET SDK release supports all of the functionality present in the associated Vantiv eCommerce XML version (e.g., SDK v9.3.2 supports Vantiv eCommerce XML v9.3). Please see the online copy of our XSD for Vantiv eCommerce XML to get more details on what the Vantiv eCommerce payments engine supports. -This SDK is implemented to support the .NET plaform, including C#, VB.NET and Managed C++ and was created by Litle & Co. It is intended use is for online transactions processing utilizing your account on the Litle payments engine. +This SDK is implemented to support the .NET plaform, including C#, VB.NET and Managed C++ and was created by Vantiv eCommerce. Its intended use is for online transactions processing utilizing your account on the Vantiv eComerce payments engine. See LICENSE file for details on using this software. Source Code available from : https://github.com/LitleCo/litle-sdk-for-dotNet -Please contact [Litle & Co.](http://www.litle.com) to receive valid merchant credentials in order to run tests successfully or if you require assistance in any way. We are reachable at sdksupport@litle.com +Please contact [Vantiv eCommerce](https://developer.vantiv.com/community/ecommerce) to receive valid merchant credentials in order to run tests successfully or if you require assistance in any way. We are reachable at sdksupport@Vantiv.com Setup ----- @@ -80,4 +80,4 @@ using Litle.Sdk; More examples can be found here [.Net Gists](https://gist.github.com/search?q=.net+sdk+Litle) or [Here](http://litleco.github.io/dotnet/) or in [Functional and Unit Tests] (https://github.com/LitleCo/litle-sdk-for-dotNet/tree/master/LitleSdkForNet/LitleSdkForNetTest) -Please contact Litle & Co. with any further questions. You can reach us at sdksupport@litle.com. +Please contact Vantiv eCommerce with any further questions. You can reach us at sdksupport@Vantiv.com. diff --git a/kit.bat b/kit.bat index d63cdd51..ee9f83f5 100644 --- a/kit.bat +++ b/kit.bat @@ -3,8 +3,8 @@ IF "%1"==[] ( exit /b ) -copy LitleSdkForNet\LitleSdkForNet\bin\Debug\LitleSdkForDotNet.dll .\ -copy LitleSdkForNet\LitleSdkForNet\bin\Debug\LitleSdkForDotNet.dll.config .\ -"C:\Program Files\7-Zip\7z.exe" a LitleSdkForDotNet-%1.zip CHANGELOG LICENSE LitleSdkForDotNet.dll LitleSdkForDotNet.dll.config README.md -del LitleSdkForDotNet.dll -del LitleSdkForDotNet.dll.config +copy LitleSdkForNet\LitleSdkForNet\bin\Release\LitleSdkForNet.dll .\ +copy LitleSdkForNet\LitleSdkForNet\bin\Release\LitleSdkForNet.dll.config .\ +"C:\Program Files\7-Zip\7z.exe" a LitleSdkForNet-%1.zip CHANGELOG LICENSE LitleSdkForNet.dll LitleSdkForNet.dll.config README.md +del LitleSdkForNet.dll +del LitleSdkForNet.dll.config