Refactor subscription pricing and update server limit

This commit is contained in:
Andras Bacsai
2024-02-25 14:00:35 +01:00
parent 1fcbf0b363
commit 1b055f0316
3 changed files with 36 additions and 23 deletions

View File

@@ -875,6 +875,14 @@ Route::post('/payments/stripe/events', function () {
$alreadyCancelAtPeriodEnd = data_get($subscription, 'stripe_cancel_at_period_end');
$feedback = data_get($data, 'cancellation_details.feedback');
$comment = data_get($data, 'cancellation_details.comment');
$lookup_key = data_get($data, 'items.data.0.price.lookup_key');
if (str($lookup_key)->contains('ultimate')) {
$quantity = data_get($data, 'items.data.0.quantity', 10);
$team = data_get($subscription, 'team');
$team->update([
'custom_server_limit' => $quantity,
]);
}
$subscription->update([
'stripe_feedback' => $feedback,
'stripe_comment' => $comment,