stripe-java icon indicating copy to clipboard operation
stripe-java copied to clipboard

Constants for possible decline_codes

Open eaglerainbow opened this issue 6 years ago • 4 comments

Is there a place with constants of all the possible decline_codes, such that a consumer is able to use them without specifying a literal?

https://github.com/stripe/stripe-java/blob/f773212886e7da424e4d8ed7eb9c34e905646c5f/src/main/java/com/stripe/model/StripeError.java#L29

eaglerainbow avatar Oct 16 '19 14:10 eaglerainbow

@eaglerainbow At the moment all enums or enum-like properties are represented as String in the library. We would like to add support for enums in the future so that all possible values are in the library but it requires some design decision before moving in that direction.

Decline codes are not in the library for that reason and you would need to build your own list instead.

Tagging as future as this is definitely something we want to tackle at some point though.

remi-stripe avatar Oct 16 '19 15:10 remi-stripe

We would like to add support for enums in the future so that all possible values are in the library but it requires some design decision before moving in that direction.

Tagging as future as this is definitely something we want to tackle at some point though.

That's okay with me. Thanks for letting me know!

eaglerainbow avatar Oct 16 '19 20:10 eaglerainbow

Upvoting since we would have the same request for Subscription.status, for example.

Reading the javadoc on the property:

Possible values are incomplete, incomplete_expired, trialing, active, past_due, canceled, or unpaid.

It would be easier to just have this gathered under an enum.

Not sure why you closed the issue though, if it's not resolved?

adrogon avatar Nov 13 '19 11:11 adrogon

Re-opened to make it easier to track in that case. We are definitely looking at how to support enums in our client libraries properly. This won't happen in the short term but it's on our roadmap!

remi-stripe avatar Nov 13 '19 17:11 remi-stripe