swish-api-csharp
swish-api-csharp copied to clipboard
TestApplication does not work
I am trying the test appliation and can't get it to work. I just cloned the repo and started the test application. It seems to be related to the certificates but I am not sure.
Has anyone else the same problem with the Merchant Swish Simulator environment?
Running on Windows 11d. Stack strace below
MakePaymentRequest - ERROR: System.AggregateException: One or more errors occurred. (An error occurred while sending the request.)
---> System.Net.Http.HttpRequestException: An error occurred while sending the request.
---> System.IO.IOException: The decryption operation failed, see inner exception.
---> System.ComponentModel.Win32Exception (0x80090326): The message received was unexpected or badly formatted.
--- End of inner exception stack trace ---
at System.Net.Security.SslStream.ReadAsyncInternal[TIOAdapter](Memory`1 buffer, CancellationToken cancellationToken)
at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
at System.Net.Http.HttpConnection.InitialFillAsync(Boolean async)
at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at SwishApi.LoggingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) in A:\Kombispel\swish-api-csharp\SwishApi\LoggingHandler.cs:line 32
at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at SwishApi.ECommerceClient.MakePaymentRequest(String swishNumberToPay, Decimal amount, String message, String instructionUUID) in A:\Kombispel\swish-api-csharp\SwishApi\ECommerceClient.cs:line 117
I managed to get it to work by changing UseMachineKeySet to false which will add the CA certificates to the Certificate Store. However, I am not sure if this will work in a linux container app running in Azure. Will investigate further