Fixes for tests

This commit is contained in:
David Bomba 2024-09-25 08:27:21 +10:00
parent 245a10cab8
commit 0f34b3d03d
3 changed files with 35 additions and 39 deletions

View File

@ -11,32 +11,33 @@
namespace App\Exceptions;
use App\Utils\Ninja;
use Aws\Exception\CredentialsException;
use GuzzleHttp\Exception\ConnectException;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundException;
use Illuminate\Database\Eloquent\RelationNotFoundException;
use Illuminate\Encryption\MissingAppKeyException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Http\Exceptions\ThrottleRequestsException;
use Illuminate\Http\Request;
use Illuminate\Queue\MaxAttemptsExceededException;
use Illuminate\Session\TokenMismatchException;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Schema;
use Illuminate\Validation\ValidationException;
use InvalidArgumentException;
use League\Flysystem\UnableToCreateDirectory;
use PDOException;
use Sentry\Laravel\Integration;
use Sentry\State\Scope;
use Symfony\Component\Console\Exception\CommandNotFoundException;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Process\Exception\RuntimeException;
use Throwable;
use PDOException;
use App\Utils\Ninja;
use Sentry\State\Scope;
use Illuminate\Support\Arr;
use Illuminate\Http\Request;
use InvalidArgumentException;
use Sentry\Laravel\Integration;
use Illuminate\Support\Facades\Schema;
use Aws\Exception\CredentialsException;
use Illuminate\Database\QueryException;
use GuzzleHttp\Exception\ConnectException;
use Illuminate\Auth\AuthenticationException;
use League\Flysystem\UnableToCreateDirectory;
use Illuminate\Session\TokenMismatchException;
use Illuminate\Validation\ValidationException;
use Illuminate\Encryption\MissingAppKeyException;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Queue\MaxAttemptsExceededException;
use Illuminate\Http\Exceptions\ThrottleRequestsException;
use Symfony\Component\Process\Exception\RuntimeException;
use Illuminate\Database\Eloquent\RelationNotFoundException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Symfony\Component\Console\Exception\CommandNotFoundException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundException;
class Handler extends ExceptionHandler
{
@ -52,6 +53,7 @@ class Handler extends ExceptionHandler
ValidationException::class,
// ModelNotFoundException::class,
NotFoundHttpException::class,
RelationNotFoundException::class,
];
protected $selfHostDontReport = [
@ -65,6 +67,8 @@ class Handler extends ExceptionHandler
RuntimeException::class,
InvalidArgumentException::class,
CredentialsException::class,
RelationNotFoundException::class,
QueryException::class,
];
protected $hostedDontReport = [
@ -73,6 +77,7 @@ class Handler extends ExceptionHandler
ValidationException::class,
ModelNotFoundException::class,
NotFoundHttpException::class,
RelationNotFoundException::class,
];
/**

View File

@ -37,19 +37,6 @@ class StripeConnectController extends BaseController
MultiDB::findAndSetDbByCompanyKey($request->getTokenContent()['company_key']);
// $company_gateway = CompanyGateway::query()
// ->where('gateway_key', 'd14dd26a47cecc30fdd65700bfb67b34')
// ->where('company_id', $request->getCompany()->id)
// ->first();
// if ($company_gateway) {
// $config = $company_gateway->getConfig();
// if (property_exists($config, 'account_id') && strlen($config->account_id) > 5) {
// return view('auth.connect.existing');
// }
// }
$stripe_client_id = config('ninja.ninja_stripe_client_id');
$redirect_uri = config('ninja.app_url').'/stripe/completed';
$endpoint = "https://connect.stripe.com/oauth/authorize?response_type=code&client_id={$stripe_client_id}&redirect_uri={$redirect_uri}&scope=read_write&state={$token}";
@ -98,6 +85,10 @@ class StripeConnectController extends BaseController
return view('auth.connect.access_denied');
}
if(!$request->getTokenContent()) {
return view('auth.connect.session_expired');
}
MultiDB::findAndSetDbByCompanyKey($request->getTokenContent()['company_key']);
$company = Company::query()->where('company_key', $request->getTokenContent()['company_key'])->first();

View File

@ -89,7 +89,7 @@ class ProcessMailgunWebhook implements ShouldQueue
{
nlog($this->request);
if(!$this->request['event-data']['tags'][0]) {
if(!$this->request['event-data']['tags'][0] ?? false) { //@phpstan-ignore-line
return;
}