Skip to content

make updateUserStripePaymentDetails more composable #376

@vincanger

Description

@vincanger
Collaborator

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),
])

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @vincanger

        Issue actions

          make `updateUserStripePaymentDetails` more composable · Issue #376 · wasp-lang/open-saas