use stripe subscription status
parent
2f186c3317
commit
ab9615f907
|
@ -224,7 +224,7 @@ final class PlanApi(
|
|||
case None =>
|
||||
logger.warn(s"${user.username} sync: unset DB patron that's not in stripe")
|
||||
patronColl.update.one($id(patron.id), patron.removeStripe) >> sync(user)
|
||||
case Some(customer) if customer.firstSubscription.isDefined && !user.plan.active =>
|
||||
case Some(customer) if customer.firstSubscription.exists(_.isActive) && !user.plan.active =>
|
||||
logger.warn(s"${user.username} sync: enable plan of customer with a subscription")
|
||||
setDbUserPlan(user, user.plan.enable) inject ReloadUser
|
||||
case customer => fuccess(Synced(patron.some, customer))
|
||||
|
|
|
@ -72,10 +72,11 @@ case class StripeSubscription(
|
|||
id: String,
|
||||
plan: StripePlan,
|
||||
customer: CustomerId,
|
||||
cancel_at_period_end: Boolean
|
||||
cancel_at_period_end: Boolean,
|
||||
status: String
|
||||
) {
|
||||
|
||||
def renew = !cancel_at_period_end
|
||||
def renew = !cancel_at_period_end
|
||||
def isActive = status == "active"
|
||||
}
|
||||
|
||||
case class StripeCustomer(
|
||||
|
|
Loading…
Reference in New Issue