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

Support Stripe Connect by adding stripe_account header namespace for customers #762

Merged
merged 1 commit into from
Feb 18, 2021

Conversation

csalvato
Copy link
Collaborator

@csalvato csalvato commented Jan 4, 2021

The Stripe library allows us to use pretty much every API call with an optional stripe_account key/value pair that is the Stripe user ID of the connected account. For example:

Stripe::Customer.update(connected_customer.id, { some: 'hash with customer data' }, stripe_account: 'some_stripe_user_id_string' )

The current implementation of this mocking library does not correctly mock this API. It will always use the default Stripe API key, when it should determine which API key to use based on the stripe_account key.

Any data relative to that account should be namespaced accordingly for future retrieval later when using the same stripe_account data.

For example, if you are creating a customer using stripe_account: customer_1_stripe_id, then this customer should not appear in a Customer.list call using strip_account: customer_2_stripe_id.

This PR accomplishes this by namespacing the mock requests and data based on the stripe_account key...and if it's not provided, we default back to the app's Stripe API key.

@csalvato csalvato changed the title Adds stripe_account header namespace for customers Support Stripe Connect by adding stripe_account header namespace for customers Jan 4, 2021
@csalvato
Copy link
Collaborator Author

csalvato commented Feb 7, 2021

What do I need to do to get this merged?

@csalvato
Copy link
Collaborator Author

I've been using these changes for several months on a private branch so think they are good to merge. Merging this in.

@csalvato csalvato merged commit 0a8870c into stripe-ruby-mock:master Feb 18, 2021
@csalvato csalvato deleted the support-connect-3 branch February 18, 2021 01:35
MaicolBen added a commit to MaicolBen/stripe-ruby-mock that referenced this pull request Sep 24, 2021
…' for nil:NilClass

With the new change in stripe-ruby-mock#762 of namespacing
stripe accounts, now the code fails differently
if the stripe account namespace is not set
MaicolBen added a commit to MaicolBen/stripe-ruby-mock that referenced this pull request Sep 24, 2021
…' for nil:NilClass

With the new change in stripe-ruby-mock#762 of namespacing
stripe accounts, now the code fails differently
if the stripe account namespace is not set
MaicolBen added a commit to MaicolBen/stripe-ruby-mock that referenced this pull request Sep 24, 2021
…' for nil:NilClass

With the new change in stripe-ruby-mock#762 of namespacing
stripe accounts, now the code fails differently
if the stripe account namespace is not set
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

Successfully merging this pull request may close these issues.

None yet

1 participant