adrienverge / localstripe

A fake but stateful Stripe server that you can run locally, for testing purposes.
GNU General Public License v3.0
192 stars 59 forks source link

Updating client using source prop is not working #177

Open fernandoiwamoto opened 3 years ago

fernandoiwamoto commented 3 years ago

I have my integration with rails and when I create customer as Stripe::Customer.create({ source: source }), I can see the sources object there. But then when I try to update my Customer, it gives me Bad Request as Stripe::Customer.update(stripe_customer_id, { source: card_token }). Using any other props, it works fine.

Copying this code https://github.com/adrienverge/localstripe/blob/master/localstripe/resources.py#L715 To https://github.com/adrienverge/localstripe/blob/master/localstripe/resources.py#L721 Works fine.

H--o-l commented 3 years ago

Hi @fernandoiwamoto thanks for sharing!

It's totally possible that one property available in the real Stripe API is missing inside localstripe. localstripe only implement what's contributors have contributes. So don't hesitate to open a PR to propose code changes or new code!

In your PR, please include links to relevant Stripe API documentation, so we can easily check. Also, don't forget to say that you have tested with the real Stripe API (you must test it with it). Last things: you will be asked to add a small unit-test inside this file https://github.com/adrienverge/localstripe/blob/2709044ab35698ab7cd80fb9dab05933aedbb551/test.sh, so prepare a small example using CURL ;-)

PS: ourself in our APP, to update a customer payment method, we use customer update API invoice_settings.default_payment_method parameter and it works with localstripe. Maybe you could use it too? (I'm not saying is better, I don't know, I'm just saying that it works out-of-the-box with localstripe).