chargebee-dotnet icon indicating copy to clipboard operation
chargebee-dotnet copied to clipboard

System.ArgumentException when parsing the test webhook payload

Open osilvaa opened this issue 11 months ago • 1 comments

Description of the Bug

I'm getting a System.ArgumentException when I read the Event object after serialization using either of the supported methods provided by the SDK.

var eventDto1 = ApiConfig.DeserializeObject<Event>(jsonString); var eventDto2 = new Event(jsonString);

This is the error:

Property accessor 'Index' on object 'ChargeBee.Models.Subscription+SubscriptionShippingAddress' threw the following exception:'The property index is not present!' System.Reflection.TargetInvocationException: Property accessor 'Index' on object 'ChargeBee.Models.Subscription+SubscriptionShippingAddress' threw the following exception:'The property index is not present!' ---> System.ArgumentException: The property index is not present! at ChargeBee.Internal.Resource.ThrowIfKeyMissed(String key) at ChargeBee.Internal.Resource.GetValue[T](String key, Boolean required) at ChargeBee.Models.Subscription.SubscriptionShippingAddress.get_Index() at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor) at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

Steps to reproduce

Described above.

Expected Behavior

A shipping address with no index shouldn't throw an exception. Similarly, the test webhook function should provide a payload that doesn't throw exceptions when hooked up with the provided client.

In our context, we have interceptors that look into the object properties.

Code Snippets (if applicable)

No response

Operating System

Windows

Language version

.NET8

Library version

v3.0.0 and 3.15.0

Additional context

No response

osilvaa avatar Mar 11 '24 21:03 osilvaa