CyberSource / cybersource-sdk-dotnet

.Net SDK for the CyberSource Simple Order API
Other
33 stars 52 forks source link

NVP Client Type conversion error when logging and passing in non-string values #58

Open joesolano opened 3 years ago

joesolano commented 3 years ago

When using the NVP Client and passing in values which are not strings the client successfully processes the transactions fine. If you enable logging then the logger fails with a type conversion error: "Unable to cast object of type 'System.Double' to type 'System.String'." StackTrace " at CyberSource.Base.Logger.GetLogString(MessageType type, Hashtable table)\r\n at CyberSource.Base.Logger.LogRequest(Hashtable request, Boolean demo)\r\n at CyberSource.Clients.NVPClient.RunTransaction(Configuration config, Hashtable request)\r\n

To reproduce this change the following line in the NVPSample.cs request.Add( "item_0_unitPrice", "12.34" ); to request.Add( "item_0_unitPrice", 12.34);

And enable logging in the config:

I would have expected either the transaction to fail when passing in non-string values OR the logger to succeed when passing in non-string values.