-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serializing a parent object with a Chargebee Subscription fails #71
Comments
Hi @dcreeronbemo, |
Hello @cb-alish. Thanks for the quick response. I see from the code that the CB SubscriptionContractTerm.SubscriptionId is supposed to be required. Our code is calling: EntityResult chargebeeResult = With the 3.20.0 NUGET package (or the project directly in our code) with the default "required == true" then the ContractTerm.SubscriptionId isn't populated and throws the error. This causes the serialization further downstream to fail. If I set required == false, then the ContractTerm.SubscriptionId value is set to null, and the serialization works. It seems to me that the data being returned from the API call isn't populating the ContractTerm.SubscriptionId for some reason. For what it's worth, the rest of the ContractTerm looks like it's populated correctly (see attached screenshot). |
Additional info @cb-alish. A co-worker performed an API get subscription call directly and got the following JSON. Notice how the "contract_term" doesn't contain a "subscription_id" property. It does have an "id" property, which matches the parent subscription id. To me the "id" of the contract_term seems like it should be a unique id for the contract_term, and not the id of the parent subscription. Thus, the need/thought for having a SubscriptionId ("subscription_id") property. I'm guessing someone set Id instead of SubscriptionId, thus overwriting the ContractTerm unique Id, and not setting the Contract Term subscription Id. "subscription": { |
@cb-alish Hello. Any updates or suggestions? We're having a similar issue with SubscriptionAddress as well. Thanks. |
Hi @dcreeronbemo, we're working on the fix and will update you here once it's ready. Could you also provide more details on |
Thanks for the response @cb-alish. The issue is the same as the earlier issue, just a different object. In this case Subscription. We try to get the Subscriptions for a specific user by:
We save this list into a parent object and then try to serial the parent object. The serialization throws an exception: "Exception caught: ArgumentException The problem appears to be that it's trying to serialize the Subscription.ShippingAddress and throwing this error. at ChargeBee.Internal.Resource.ThrowIfKeyMissed(String key) Th |
Hi @dcreeronbemo, The issue with We're working on the |
Thanks @cb-alish. I updated the project to go back to the Chargebee dotnet 3.24.0 NUGET package, and initial testing is working as expected. Was there a change to the NUGET package source (I didn't see anything related, but may have missed it) or was it a backend issue? |
Hi @dcreeronbemo, it was a backend issue. |
Description of the Bug
We have a class that has a property for ChargeBee.Models.Subscription. When we try and serialize this parent class we get an exception with the following details:
Error getting value from 'SubscriptionId' on 'ChargeBee.Models.Subscription+SubscriptionContractTerm'.
The property subscription_id is not present!
If I look in the debug visualizer and drill down to the ChargeBeeSubscription.ContractTerm.SubscriptionId I see a circular red-X for the property, and the value is:
"'(new System.Collections.Generic.ICollectionDebugView<Bemo.Services.ShoppingCart.Models.BemoCartLineItem>(value.LineItems).Items[0]).BemoSub.ChargeBeeSubscription.ContractTerm.SubscriptionId' threw an exception of type 'System.ArgumentException'"
If I clone the latest chargebee-dotnet repository, include the project in my solution, and then comment out the SubscriptionContractTerm.SubscriptionId property in Subscription.cs (lines 6540-6542) then the serialization works as expected. ETA: I can also change that property so the call the GetValue() sets the "required" parameter to false.
Steps to reproduce
Expected Behavior
Serialization should not throw this exception.
Code Snippets (if applicable)
No response
Operating System
Windows 10/11
Language version
.Net 8.0
Library version
v3.20.0
Additional context
No response
The text was updated successfully, but these errors were encountered: