chargebee / chargebee-java

Java library for the Chargebee API.
https://apidocs.chargebee.com/docs/api?lang=java
MIT License
30 stars 25 forks source link

Add subscriptions in ResultBase object #42

Open alisabzevari opened 7 months ago

alisabzevari commented 7 months ago

What problem does your feature request address?

We realized that some events (for example "Customer deleted") contains subscriptions field (collection of customer subscriptions). However, the type com.chargebee.models.Event.content() which is the representation of event content does not provide a method to access this field.

Describe the desired solution

The desired solution would be to make subscriptions method available in ResultBase this possible:

Event event = // the instance of event
var subscriptions = event.content().subscriptions(); // This is not available 
var subscription = event.content().subscription(); // This is availabale

it would be great if we could add this method.

Alternatives considered

Currently, we access the list of subscriptions via parsing the JSONObject:

var subscriptions = this.optJSONObject("content").optJSONArray("subscriptions");

Additional context

The subscriptions field is mentioned in the documentation for customer_deleted event here

github-actions[bot] commented 7 months ago

Hello @alisabzevari, thank you for raising the issue. Your contribution is greatly appreciated and we look forward to addressing it.