diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 25b9ab51b1..7a9425d720 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -57,25 +57,29 @@ class Handler extends ExceptionHandler */ public function report(Exception $exception) { - if(!Schema::hasTable('accounts')) + if(!Schema::hasTable('accounts')){ + info("account table not found"); return; + } if (app()->bound('sentry') && $this->shouldReport($exception)) { - app('sentry')->configureScope(function (Scope $scope): void { - if (auth()->guard('contact') && auth()->guard('contact')->user() && auth()->guard('contact')->user()->company->account->report_errors) { - $scope->setUser([ - 'id' => auth()->guard('contact')->user()->company->account->key, - 'email' => "anonymous@example.com", - 'name' => "Anonymous User", - ]); - } elseif (auth()->guard('user')->user() && auth()->user()->company() && auth()->user()->company()->account->report_errors) { - $scope->setUser([ - 'id' => auth()->user()->account->key, - 'email' => "anonymous@example.com", - 'name' => "Anonymous User", - ]); - } - }); + + // app('sentry')->configureScope(function (Scope $scope): void { + + // if (auth()->guard('contact') && auth()->guard('contact')->user() && auth()->guard('contact')->user()->company->account->report_errors) { + // $scope->setUser([ + // 'id' => auth()->guard('contact')->user()->company->account->key, + // 'email' => "anonymous@example.com", + // 'name' => "Anonymous User", + // ]); + // } elseif (auth()->guard('user') && auth()->guard('user')->user() && auth()->user()->company() && auth()->user()->company()->account->report_errors) { + // $scope->setUser([ + // 'id' => auth()->user()->account->key, + // 'email' => "anonymous@example.com", + // 'name' => "Anonymous User", + // ]); + // } + // }); app('sentry')->captureException($exception); } diff --git a/app/Http/Controllers/DesignController.php b/app/Http/Controllers/DesignController.php index 77c465b19e..833f7b7f41 100644 --- a/app/Http/Controllers/DesignController.php +++ b/app/Http/Controllers/DesignController.php @@ -484,7 +484,7 @@ class DesignController extends BaseController $designs->each(function ($design, $key) use ($action) { if (auth()->user()->can('edit', $design)) { - $this->design_repo->{$action}($design);@todo + $this->design_repo->{$action}($design); } }); diff --git a/app/Http/Requests/Payment/StorePaymentRequest.php b/app/Http/Requests/Payment/StorePaymentRequest.php index e553cfba30..a46f5c68f8 100644 --- a/app/Http/Requests/Payment/StorePaymentRequest.php +++ b/app/Http/Requests/Payment/StorePaymentRequest.php @@ -76,6 +76,8 @@ class StorePaymentRequest extends Request $input['is_manual'] = true; + info(print_r($input,1)); + $this->replace($input); } diff --git a/app/Transformers/PaymentTransformer.php b/app/Transformers/PaymentTransformer.php index 9889e6f18d..1347a760cf 100644 --- a/app/Transformers/PaymentTransformer.php +++ b/app/Transformers/PaymentTransformer.php @@ -23,7 +23,7 @@ class PaymentTransformer extends EntityTransformer protected $serializer; - protected $defaultIncludes = []; + protected $defaultIncludes = ['invoices']; protected $availableIncludes = [ 'client', diff --git a/tests/Feature/PaymentTest.php b/tests/Feature/PaymentTest.php index 8963494ce2..afae8009eb 100644 --- a/tests/Feature/PaymentTest.php +++ b/tests/Feature/PaymentTest.php @@ -191,7 +191,7 @@ class PaymentTest extends TestCase $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, - ])->post('/api/v1/payments?include=invoices', $data); + ])->post('/api/v1/payments?include=invoices,paymentables', $data); } catch (ValidationException $e) { $message = json_decode($e->validator->getMessageBag(), 1); $this->assertNotNull($message); @@ -204,6 +204,7 @@ class PaymentTest extends TestCase $payment_id = $arr['data']['id']; $payment = Payment::find($this->decodePrimaryKey($payment_id))->first(); + $payment->load('invoices'); $this->assertNotNull($payment); $this->assertNotNull($payment->invoices()); @@ -663,7 +664,7 @@ class PaymentTest extends TestCase } if ($response) { - $response->assertStatus(302); + $response->assertStatus(200); } }