Skip to content
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

ToJSON for StripeError #36

Open
bitemyapp opened this issue Apr 14, 2016 · 10 comments
Open

ToJSON for StripeError #36

bitemyapp opened this issue Apr 14, 2016 · 10 comments

Comments

@bitemyapp
Copy link
Contributor

Is there ever sensitive information in the StripeError value? If not, could there be a ToJSON instance? It'd spare me playing data-relay with the error since I'd just be passing the same information down to the JS client.

@dmjio
Copy link
Owner

dmjio commented Apr 14, 2016

Hey, I don't think any sensitive info would be transmitted in the error messages (certainly not API keys, although maybe customer ids - but those aren't understandable). I see nothing wrong with a ToJSON instance for StripeError, as long as consumers of this library know that it is for convenience purposes. Since StripeErrors can only be received from stripe. The only alternative would be to wrap StripeError in a newtype. So yea, ToJSON StripeError sounds good to me. 👍

@bitemyapp
Copy link
Contributor Author

bitemyapp commented Apr 14, 2016

Also,
screenshot from 2016-04-14 14-30-46
screenshot from 2016-04-14 14-30-42

@dmjio so, do you usually make one-off API types for this sort of thing?

@dmjio
Copy link
Owner

dmjio commented Apr 14, 2016

Stripe's APIs don't accept JSON, but return it. A NewCard is meant to be submitted as a form url-encoded query parameter.

@bitemyapp
Copy link
Contributor Author

bitemyapp commented Apr 14, 2016

@dmjio oh sure, I was thinking of recycling the datatype for inputs from our SPA client, reduce petty surface area.

@dmjio
Copy link
Owner

dmjio commented Apr 14, 2016

@bitemyapp, Ah I see, I suppose we could add To/FromJSON instances to types like NewCard. I can see how that would fit a use case. Would need to ensure the isomorphisms hold. Want to avoid user confusion though.

@dmjio
Copy link
Owner

dmjio commented Apr 14, 2016

@bitemyapp would you want just NewCard? Or others as well? I assume a lot of people are probably going to want to this as well ...

@bitemyapp
Copy link
Contributor Author

@dmjio well, sorta just plugging away as I go really. Think NewCard, SubscriptionId, and StripeError would cover it for now.

@dmjio
Copy link
Owner

dmjio commented Apr 14, 2016

Sounds like the beginnings of a branch, I'll start one.

@bitemyapp
Copy link
Contributor Author

@dmjio ty ty <3

@dmjio
Copy link
Owner

dmjio commented Apr 14, 2016

:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants