Open ole-magnus opened 4 months ago
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code
oh, just noticed this one now: https://github.com/chargebee/chargebee-typescript/pull/45. Although I'm not sure it's correct to provide union values in lowercase as done there.
@cb-khushbubibay @cb-yateshmathuria @cb-nithins @cb-thushitamariaselvan FYI
Context
A typical use case for me is to check the
value
when fetchingSubscriptionEntitlement
. One example API call:The value heavily depends on the
feature_type
. E.g.value
is a string representation of an integer, let's say"5"
, whenfeature_type
isQUANTITY
. In this scenario, I might want toparseInt(value, 10)
in order to perform arithmetics on the value and so on. That said, I believe this can beunlimited
as well so one should be careful here I would presume.That said, the value might also be
available
, e.g. if thefeature_type
is"SWITCH"
. Then the formerly mentioned comparison of integers make no sense.In summary, my point is the feature_type is essential when checking if a user has access. I'm not sure how this can be overlooked in this API and it makes me actually question if my approach is valid. Let me know if there are better ways to check access using features/entitlements.
Description of changeset
Adds
feature_type
to theSubscriptionEntitlement
model as this is available in the API response. If this is always expected to be present, I would prefer to change this to non-optional.