feat: clear grace period on invoice.payment_succeeded
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,7 @@ final class HandleStripeWebhook
|
||||
'customer.subscription.created',
|
||||
'customer.subscription.updated' => $this->bustPlanCache($user),
|
||||
'customer.subscription.deleted' => $this->handleSubscriptionDeleted($user),
|
||||
'invoice.payment_succeeded' => $this->handlePaymentSucceeded($user),
|
||||
default => null,
|
||||
};
|
||||
}
|
||||
@@ -44,6 +45,12 @@ final class HandleStripeWebhook
|
||||
$this->bustPlanCache($user);
|
||||
}
|
||||
|
||||
private function handlePaymentSucceeded(User $user): void
|
||||
{
|
||||
$user->forceFill(['grace_period_until' => null])->save();
|
||||
$this->bustPlanCache($user);
|
||||
}
|
||||
|
||||
private function bustPlanCache(User $user): void
|
||||
{
|
||||
Cache::tags(['plans'])->forget("plan_for_user_{$user->id}");
|
||||
|
||||
Reference in New Issue
Block a user