fix: fix subscription cancel (#2886)

This commit is contained in:
Alexis Saettler
2019-08-11 18:35:30 +02:00
committed by GitHub
parent dfb7b07ff4
commit 557f34bf55
17 changed files with 445 additions and 117 deletions
+7 -1
View File
@@ -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();