fix: fix subscription cancel (#2886)
This commit is contained in:
@@ -19,6 +19,7 @@ use App\Models\Account\ImportJob;
|
||||
use App\Models\Account\Invitation;
|
||||
use App\Services\User\EmailChange;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Exceptions\StripeException;
|
||||
use Lahaxearnaud\U2f\Models\U2fKey;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Http\Requests\ImportsRequest;
|
||||
@@ -178,7 +179,12 @@ class SettingsController
|
||||
$account = auth()->user()->account;
|
||||
|
||||
if ($account->isSubscribed() && ! $account->has_access_to_paid_version_for_free) {
|
||||
$account->subscriptionCancel();
|
||||
try {
|
||||
$account->subscriptionCancel();
|
||||
} catch (StripeException $e) {
|
||||
return redirect()->route('settings.index')
|
||||
->withErrors($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
DB::table('accounts')->where('id', $account->id)->delete();
|
||||
|
||||
Reference in New Issue
Block a user