Skip to content

System.ArgumentException when parsing the test webhook payload #64

@osilvaa

Description

@osilvaa

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions