I have this code there...
var ewayClient = RapidClientFactory.NewRapidClient(Platform.eWayApiKey, Platform.eWayPassword, EndPoint);
ewayClient.SetVersion(31);
var transaction = CreateTransaction();
var preAuthTransaction = ewayClient.Create(PaymentMethod.ResponsiveShared, transaction);
Assert.IsNull(preAuthTransaction.Errors);
It works as expected in a unit test, but if I run it within the context of a running web application, it returns an error.
I have two separate ASP.NET applications set up in two separate solutions. Each has a unit test running the code above. In both solutions the test passes.
I copy the same code into a basic GET controller action (not including the assertion) and the first solution gets a result back with no Errors, but the second solution gets the dreaded S9992 error.
Both sites are running on IIS Express 10.
How can the same code run in 4 separate contexts, yet one context (of running in web application locally and when deployed to Azure)
It doesn't currently make sense.
I have confirmed the ApiKey and Password is correct and is the same across all four contexts. Create Transaction is hardcoded with a few common properties/addresses/etc.
NOTE: I'm using NuGet package version 1.6.0-beta1
I finally found the solution.
I had to set the SecurityProtocol which I now do in the global.asax
I know eWay were changing to require TLS 1.2 (see https://myeway.force.com/success/s/article/ka828000000L2mlAAC/I-am-testing-in-Sandbox-and-I-am-receiving-an-error-that-the-connection-has-been-closed)
But why is that one .NET web app running on my development machine needed me to add that line, when another .NET web application and two unit test projects across two separate solutions didn't still alludes me.
Everything is running .NET 4.6+
It seems 4.0 and 4.5 don't support TLS 1.2 by default and that 4.6+ does. My one app that is failing is starting up set to Ssl3. But it is .NET 4.6.1 so I'm confused.