chore: Add null checks for team in Stripe webhook
This commit is contained in:
parent
c30185c6ae
commit
2f621279c2
@ -170,9 +170,11 @@ public function events(Request $request)
|
|||||||
$quantity = data_get($data, 'items.data.0.quantity', 10);
|
$quantity = data_get($data, 'items.data.0.quantity', 10);
|
||||||
}
|
}
|
||||||
$team = data_get($subscription, 'team');
|
$team = data_get($subscription, 'team');
|
||||||
$team->update([
|
if ($team) {
|
||||||
'custom_server_limit' => $quantity,
|
$team->update([
|
||||||
]);
|
'custom_server_limit' => $quantity,
|
||||||
|
]);
|
||||||
|
}
|
||||||
ServerLimitCheckJob::dispatch($team);
|
ServerLimitCheckJob::dispatch($team);
|
||||||
}
|
}
|
||||||
$subscription->update([
|
$subscription->update([
|
||||||
@ -214,7 +216,9 @@ public function events(Request $request)
|
|||||||
$customerId = data_get($data, 'customer');
|
$customerId = data_get($data, 'customer');
|
||||||
$subscription = Subscription::where('stripe_customer_id', $customerId)->firstOrFail();
|
$subscription = Subscription::where('stripe_customer_id', $customerId)->firstOrFail();
|
||||||
$team = data_get($subscription, 'team');
|
$team = data_get($subscription, 'team');
|
||||||
$team->trialEnded();
|
if ($team) {
|
||||||
|
$team->trialEnded();
|
||||||
|
}
|
||||||
$subscription->update([
|
$subscription->update([
|
||||||
'stripe_subscription_id' => null,
|
'stripe_subscription_id' => null,
|
||||||
'stripe_plan_id' => null,
|
'stripe_plan_id' => null,
|
||||||
|
Loading…
Reference in New Issue
Block a user