chargebee / chargebee-typescript

Typescript library for the Chargebee API.
https://apidocs.chargebee.com/docs/api?lang=typescript
MIT License
23 stars 16 forks source link

Type bug on _purchases.purchase_items_create_params unit_amount #47

Closed First-Derivative closed 6 months ago

First-Derivative commented 8 months ago

Issue:

When utilizing the Node Chargebee v2 Purchases API the types from chargebee-typescript suggest that unit_amount type should be number. However, upon testing, we have encountered an error response suggesting that the unit_amount type should be number[] instead.

Error Response:

    purchase_items[unit_amount][0] : wrong format

This error response indicates a discrepancy between the expected and actual data type for unit_amount in the _purchase.create_params object. The API documentation states that unit_amount should be of type number, but the error message implies that it is being interpreted as an array of numbers (number[]). The API call returns no error when the parameters for unit_amount are of type number[].

Expected Behavior:

The API should accept unit_amount as a number type as per the documentation, and error messages should accurately reflect any issues related to the format or type mismatch.

Impact:

This issue prevents us from properly utilizing your chargebee-typescript types. It hinders our ability to rely on your typescript definitions for API calls.

Steps to Reproduce:

Versions:

"chargebee": "2.31.0",
"chargebee-typescript": "2.29.0",
  1. Make a call to the Chargebee Purchases API to create a purchase with the unit_amount being set to a number.
  2. Observe the error response indicating an incorrect format for unit_amount.

Additional Information:

We have verified that the data being sent to the API conforms to the documented specifications. This issue occurs consistently across multiple API calls and environments. No recent changes have been made to our integration setup that could have caused this behavior.

Request:

We kindly request your prompt attention to this matter. Please investigate and resolve this discrepancy in the Chargebee API as soon as possible. If there are any updates or workarounds available, we would appreciate receiving guidance on how to proceed in the interim.

Thank you, Ash, Launched

cb-sriramthiagarajan commented 6 months ago

Hi @First-Derivative, sorry for the delay in looking into this. I'm not sure if I understand this correctly. Could you share a code snippet that results in the error

purchase_items[unit_amount][0] : wrong format

Also, I see you've mentioned both chargebee and chargebee-typescript versions. Are you seeing this error in both the SDKs?

cb-sriramthiagarajan commented 6 months ago

@First-Derivative — can you please confirm if you're still having this issue and share more details about it?

First-Derivative commented 6 months ago

Hi @cb-sriramthiagarajan, I can confirm this is no longer an issue. Most likely your API updated on on the backend and this error was resolved.

cb-sriramthiagarajan commented 6 months ago

Thank you @First-Derivative!