Adyen / adyen-dotnet-api-library

Adyen API Library for .NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Examples in README are not up to date with v10.0.0

jsyrjala opened this issue · comments

Describe the bug

For example https://github.com/Adyen/adyen-dotnet-api-library#using-the-library and https://github.com/Adyen/adyen-dotnet-api-library#example-cloud-terminal-api-integration refer to Adyen.Model.Enum.Environment which no longer exists in v10.0.0. It now has Adyen.Model.Environment instead.

Example in https://github.com/Adyen/adyen-dotnet-api-library#using-the-local-terminal-api fails with exception

System.InvalidOperationException : Missing liveEndpointUrlPrefix for endpoint generation
   at Adyen.Client.SetEnvironment(Environment environment, String liveEndpointUrlPrefix)

Java library had the same issue with their v20.0.0 release: Adyen/adyen-java-api-library#1026

Hi @jsyrjala,

Nice catch, yet again :) Thanks for pointing this out.

Best, Jilling
Adyen

Previously adyen library (v9.2.1)worked so that connecting local payment terminal in address like https://192.168.2.2:8080/nexo/ worked without any SSL complaints. SSL certificate validation didn't complain that you were connecting https://192.168.2.2:8080 but certificate on the payment terminal was issued for domain name YOUR_POIID.test.terminal.adyen.com

Now with HttpClient class you need to configure something extra to get same behaviour. This needed extra config doesn't seem to be documented.

I guess something like this is needed. Maybe this should be even default behaviour for adyen library?

            var httpClient = new HttpClient(
                HttpClientExtensions.ConfigureHttpMessageHandler(config)
            );
            httpClient.Timeout = TimeSpan.FromMilliseconds(config.Timeout);
            _adyenApi = new PosPaymentLocalApi(new Client(config, httpClient));

If this extra config is missing, then you'll get errors like these.

System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch

Hi @jsyrjala,

Thanks for reaching out with this issue and apologies for the delayed response. As far as I know you can set the SSL certificate configurations in the HttpClientHandler which you can pass in the constructor of the HttpClient. Here is a little example. Hope this fixes your issue.

I will play around with it a bit myself as well, and add some documentation as soon as I properly tested it.

Best, Jilling
Adyen