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

feat: Synchronising stripe and studio API state - [DEV-4157] #561

Merged
merged 7 commits into from
Jul 31, 2024

Conversation

jay-dee7
Copy link
Contributor

@jay-dee7 jay-dee7 commented Jul 25, 2024

This PR makes few adjustments and breaks existing assumptions about the user journeys for Stripe and our API.

  • We now create a customer (Studio) when someone subscribes on Stripe but has never signed up for our platform. This helps with Inbound Billing Journey

  • We still try to maintain consistency at runtime about 1-1 relationship between the user and customer tables. Though it's quite risky since the underlying database does not guarantee the relation terms. We could end up creating multiple customers in some edge case as long as it's not implemented at the database layer. The first step for this should be marking the customer.email as the primary or at least a unique column.

  • Allow setting the paymentProviderId while creating new Customer entity records, it was optional before anyway and we only allow to create it optionally (to avoid having to perform a create + update operation)

  • New endpoint - GET /admin/checkout/session/:id API to retrieve Stripe checkout session by ID

Warning

The get Stripe checkout session endpoint is completely open at the source (API) this of course does require some thinking but the times when this endpoint becomes useful is mostly when user is not authenticated. One thing we could do is make this authenticated and force a user login before performing any checks on client side.

@jay-dee7 jay-dee7 force-pushed the chore/add-local-dev-mode branch from bb51721 to 4f32d08 Compare July 25, 2024 07:45
@jay-dee7 jay-dee7 force-pushed the chore/add-local-dev-mode branch from 5732a42 to 241f6e4 Compare July 30, 2024 09:35
@jay-dee7 jay-dee7 force-pushed the chore/add-local-dev-mode branch from 241f6e4 to 3622762 Compare July 30, 2024 12:40
@jay-dee7 jay-dee7 changed the title chore: Add dev mode to run api in local without building feat: Synchronising stripe and studio API state Jul 30, 2024
@jay-dee7 jay-dee7 self-assigned this Jul 30, 2024
@DaevMithran
Copy link
Contributor

DaevMithran commented Jul 30, 2024

@jay-dee7 SubscriptionSubmitter -> update function is not used anywhere. Can we remove it?

.node-version Outdated Show resolved Hide resolved
@jay-dee7
Copy link
Contributor Author

@jay-dee7 SubscriptionSubmitter -> update function is not used anywhere. Can we remove it?

@DaevMithran we can't remove it. To implement IObserver interface we only need to satisfy the update method on it so it's required in implementation. Of course we might still not be using it. I'd just keep it out of scope for now.

@jay-dee7 jay-dee7 changed the title feat: Synchronising stripe and studio API state feat: Synchronising stripe and studio API state - [DEV-4157] Jul 31, 2024
@ankurdotb
Copy link
Contributor

@jay-dee7 jay-dee7 merged commit f338db7 into develop Jul 31, 2024
14 checks passed
@jay-dee7 jay-dee7 deleted the chore/add-local-dev-mode branch July 31, 2024 05:35
cheqd-bot bot pushed a commit that referenced this pull request Jul 31, 2024
## [3.1.0-develop.1](3.0.1-develop.2...3.1.0-develop.1) (2024-07-31)

### Features

* Synchronising stripe and studio API state - [DEV-4157] ([#561](#561)) ([f338db7](f338db7))
@cheqd-bot
Copy link

cheqd-bot bot commented Jul 31, 2024

🎉 This PR is included in version 3.1.0-develop.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

cheqd-bot bot pushed a commit that referenced this pull request Aug 5, 2024
## [3.1.0](3.0.0...3.1.0) (2024-08-05)

### Features

* Switch logto role assignment to subscription webhook [DEV-4164] ([#565](#565)) ([0b93908](0b93908))
* Synchronising stripe and studio API state - [DEV-4157] ([#561](#561)) ([f338db7](f338db7))

### Bug Fixes

* Return proper response on auth setup [DEV-4146] ([#560](#560)) ([690d854](690d854))
* trigger stripe account creation on sign-in ([#559](#559)) ([d2fec93](d2fec93))
* Use `admin:subscription:get` auth guard for Stripe checkout session ([#564](#564)) ([fc631e4](fc631e4))
@cheqd-bot
Copy link

cheqd-bot bot commented Aug 5, 2024

🎉 This PR is included in version 3.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@cheqd-bot cheqd-bot bot added the released label Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants