As a Stockpile owner,
I want to make sure that no partially-created subscriptions exist
so that I can more easily troubleshoot subscription problems.
When a subscription is created, it carries out the following steps:
Create Stripe customer
Create Stockpile organization
Create Stockpile user in that organization
If any of the steps fail, all the steps after it will not be completed. This means:
If an organization fails to be created, a Stripe customer will be left without a link to an organization.
If a user fails to be created, an organization will exist without any users.
The whole operation should be atomic: if any part of it fails, then the whole thing is rolled back. This will require maintaining the IDs of each of the created entities in a way that can be accessed by the .catch() on the promise chain, so that the entities can be safely deleted. It will also require a way to determine which entity prompted the error that the .catch() is handling.
As a Stockpile owner, I want to make sure that no partially-created subscriptions exist so that I can more easily troubleshoot subscription problems.
When a subscription is created, it carries out the following steps:
If any of the steps fail, all the steps after it will not be completed. This means:
The whole operation should be atomic: if any part of it fails, then the whole thing is rolled back. This will require maintaining the IDs of each of the created entities in a way that can be accessed by the
.catch()
on the promise chain, so that the entities can be safely deleted. It will also require a way to determine which entity prompted the error that the.catch()
is handling.