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

make updateUserStripePaymentDetails more composable #376

Open
vincanger opened this issue Feb 19, 2025 · 0 comments
Open

make updateUserStripePaymentDetails more composable #376

vincanger opened this issue Feb 19, 2025 · 0 comments

Comments

@vincanger
Copy link
Collaborator

vincanger commented Feb 19, 2025

From @infomiho:

I feel like the updateUserStripePaymentDetails method is doing too much, it's used for:

updating subscriptionPlan
updating datePaid
incrementing the credits
updating subscriptionStatus
I'd recommend that we refactor it into multiple smaller methods that could be very specific about what they are updating:

updateSubscriptionPlan
updateCreditsAmount
updateDatePaid
etc.
There are way to make this composable, so we only have one DB insert, we compose the data object for multiple updates and then execute the insert:

updateUserStripePaymentDetails([
  createDatePaidUpdate(datePaid),
  createSubscriptionStatusUpdate(subscriptionStatus),
])
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

No branches or pull requests

1 participant