mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 06:04:30 -04:00
Throw an renderable exception instead of returning view
This commit is contained in:
parent
f73ad4bef7
commit
6e6e73825c
21
app/Exceptions/PaymentFailed.php
Normal file
21
app/Exceptions/PaymentFailed.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
class PaymentFailed extends Exception
|
||||
{
|
||||
public function report()
|
||||
{
|
||||
// ..
|
||||
}
|
||||
|
||||
public function render($request)
|
||||
{
|
||||
return render('gateways.unsuccessful', [
|
||||
'message' => $this->getMessage(),
|
||||
'code' => $this->getCode(),
|
||||
]);
|
||||
}
|
||||
}
|
@ -12,6 +12,7 @@
|
||||
|
||||
namespace App\PaymentDrivers\CheckoutCom;
|
||||
|
||||
use App\Exceptions\PaymentFailed;
|
||||
use App\Jobs\Mail\PaymentFailureMailer;
|
||||
use App\Jobs\Util\SystemLogger;
|
||||
use App\Models\PaymentType;
|
||||
@ -92,10 +93,7 @@ trait Utilities
|
||||
$this->checkout->client
|
||||
);
|
||||
|
||||
return render('gateways.unsuccessful', [
|
||||
'code' => $_payment->http_code,
|
||||
'message' => $_payment->status,
|
||||
]);
|
||||
throw new PaymentFailed($_payment->status, $_payment->http_code);
|
||||
}
|
||||
|
||||
private function processPendingPayment(\Checkout\Models\Payments\Payment $_payment)
|
||||
@ -148,9 +146,6 @@ trait Utilities
|
||||
$this->checkout->client,
|
||||
);
|
||||
|
||||
return render('gateways.unsuccessful', [
|
||||
'error' => $e->getCode(),
|
||||
'message' => $error,
|
||||
]);
|
||||
throw new PaymentFailed($error, $e->getCode());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user