Skip to content

make updateUserStripePaymentDetails more composable #376

Open
@vincanger

Description

@vincanger

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

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

    Issue actions