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

Improve actions.customers.create with existing Customer #364

Closed

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented Sep 14, 2017

"stripe_id": stripe_customer["id"]
}
)
cus, created = models.Customer.objects.get_or_create(user=user)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StripeObject.stripe_id can't be null at present, so would this not fail if it came to creating?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a CharField, and can be blank (validation for the default blank=False is skipped here).
But there can only be one blank stripe_id (it is a unique) field.

@lukeburden
Copy link
Contributor

My main concern with this approach is the ordering of storage.

The standard approach in this project seems to be to only ever create local database entries based on data that is confirmed to exist on Stripe's side. Reversing this means there is potential for orphaned, unpopulated Customer entries that do not correspond with any data in Stripe. Of course, the current ordering of Stripe then local DB results in the opposite problem where we may have orphaned data in Stripe that does not exist locally in our database.

Not really sure if one is better than the other, but it makes sense to me to take a consistent approach, which would be Stripe data first, local DB storage second. @paltman what are your thoughts?

@paltman
Copy link
Member

paltman commented Sep 18, 2017

Yes, I would like to keep focused on Stripe being the point of truth and local DB being a glorified cache of what Stripe has. Ideally, we should always be able to rebuild our local database (at least the pinax-stripe portion) by syncing data from the API. Though I know practically speaking at some point that becomes a very time-consuming task and there should be workarounds developed.

@blueyed
Copy link
Contributor Author

blueyed commented Sep 25, 2017

Closing for now then.

@blueyed blueyed closed this Sep 25, 2017
@blueyed blueyed deleted the improve-customers-create-with-existing branch September 25, 2017 14:48
@paltman paltman added this to the Samwise milestone Oct 20, 2017
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.

3 participants