chargebee / chargebee-java

Java library for the Chargebee API.

Home Page:https://apidocs.chargebee.com/docs/api?lang=java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add subscriptions in ResultBase object

alisabzevari opened this issue · comments

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

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