cloud: fix subs

This commit is contained in:
Andras Bacsai 2023-10-27 10:17:13 +02:00
parent eda8b34297
commit ba424efd39
5 changed files with 11 additions and 7 deletions

View File

@ -39,14 +39,18 @@ public function type()
if (!$subscription) { if (!$subscription) {
return null; return null;
} }
$subscriptionPlanId = data_get($subscription,'stripe_plan_id'); $subscriptionPlanId = data_get($subscription, 'stripe_plan_id');
if (!$subscriptionPlanId) { if (!$subscriptionPlanId) {
return null; return null;
} }
$subscriptionInvoicePaid = data_get($subscription, 'stripe_invoice_paid');
if (!$subscriptionInvoicePaid) {
return null;
}
$subscriptionConfigs = collect(config('subscription')); $subscriptionConfigs = collect(config('subscription'));
$stripePlanId = null; $stripePlanId = null;
$subscriptionConfigs->map(function ($value, $key) use ($subscriptionPlanId, &$stripePlanId) { $subscriptionConfigs->map(function ($value, $key) use ($subscriptionPlanId, &$stripePlanId) {
if ($value === $subscriptionPlanId){ if ($value === $subscriptionPlanId) {
$stripePlanId = $key; $stripePlanId = $key;
}; };
})->first(); })->first();

View File

@ -7,7 +7,7 @@
// The release version of your application // The release version of your application
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
'release' => '4.0.0-beta.105', 'release' => '4.0.0-beta.106',
// When left empty or `null` the Laravel environment will be used // When left empty or `null` the Laravel environment will be used
'environment' => config('app.env'), 'environment' => config('app.env'),

View File

@ -1,3 +1,3 @@
<?php <?php
return '4.0.0-beta.105'; return '4.0.0-beta.106';

View File

@ -305,11 +305,11 @@
'stripe_plan_id' => $planId, 'stripe_plan_id' => $planId,
'stripe_cancel_at_period_end' => $cancelAtPeriodEnd, 'stripe_cancel_at_period_end' => $cancelAtPeriodEnd,
]); ]);
if ($status === 'paused') { if ($status === 'paused' || $status === 'incomplete_expired') {
$subscription->update([ $subscription->update([
'stripe_invoice_paid' => false, 'stripe_invoice_paid' => false,
]); ]);
send_internal_notification('Subscription paused for team: ' . $subscription->team->id); send_internal_notification('Subscription paused or incomplete for team: ' . $subscription->team->id);
} }
// Trial ended but subscribed, reactive servers // Trial ended but subscribed, reactive servers

View File

@ -4,7 +4,7 @@
"version": "3.12.36" "version": "3.12.36"
}, },
"v4": { "v4": {
"version": "4.0.0-beta.105" "version": "4.0.0-beta.106"
} }
} }
} }