CyberSource / cybersource-rest-client-dotnet

.NET client library for the CyberSource REST API
Other
19 stars 44 forks source link

Cybersouce.Client.Configuration throws The type initializer exception #145

Closed ericMaxon closed 1 year ago

ericMaxon commented 1 year ago

Hi, I'm currently implementing the CyberSource.Rest.Client on version 0.0.1.29, and when I call the CyberSource.Client.Configuration I get the next exception(see higher level exception). How can I handle this exception?. Down below I'll define my Project Configurations.

Regards.

Higher level exception

The type initializer for 'CyberSource.Client.Configuration' threw an exception.
at CyberSource.Client.ApiClient..ctor()
at CyberSource.Client.Configuration.SetApiClientUsingDefault(ApiClient apiClient)
at CyberSource.Client.Configuration..ctor(ApiClient apiClient, Dictionary'2 defaultHeader, String username, String password, String accessToken, Dictionary'2 apiKey, Dictionary'2 apiKeyPrefix, String tempFolderPath, String dateTimeFormat, Int32 timeout, String userAgent, IReadOnlyDictionary'2 merchConfigDictObj) ...

Inner level exception

Method not found: 'Void RestSharp.RestClient.set_Timeout(Int32)'. at CyberSource.Client.Configuration.set_Timeout(Int32 value) at CyberSource.Client.Configuration..ctor(ApiClient apiClient, Dictionary'2 defaultHeader, String username, String password, String accessToken, Dictionary'2 apiKey, Dictionary'2 apiKeyPrefix, String tempFolderPath, String dateTimeFormat, Int32 timeout, String userAgent, IReadOnlyDictionary'2 merchConfigDictObj) at CyberSource.Client.Configuration..cctor()

Project Configurations

My code snippet

            _cyberSourceConfiguration.Add("authenticationType", settings.authenticationType);
            _cyberSourceConfiguration.Add("merchantID", settings.merchandId);
            _cyberSourceConfiguration.Add("merchantsecretKey", settings.merchantSecretKey);
            _cyberSourceConfiguration.Add("merchantKeyId", settings.merchantKeyId);
            _cyberSourceConfiguration.Add("runEnvironment", settings.runEnvironment);
            _cyberSourceConfiguration.Add("timeout", "300000");
            _clientReferenceCode = settings.clientReferenceCode;
            _clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: _cyberSourceConfiguration);
IanSpink commented 1 year ago

This is an issue caused by a breaking change in RestSharp 107.0.1. Will there be a fix so we can move beyond RestSharp 106.12?

ericMaxon commented 1 year ago

I'll close this issue since have been resolved on 0.0.1.30