2020-05-14 03:04:23 +02:00
|
|
|
<?php
|
2023-02-09 04:06:41 +01:00
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
|
|
|
*/
|
|
|
|
|
2020-05-14 03:04:23 +02:00
|
|
|
|
|
|
|
namespace App\Exceptions;
|
|
|
|
|
|
|
|
use Exception;
|
2020-10-28 11:10:49 +01:00
|
|
|
use Illuminate\Http\Request;
|
2023-07-25 12:04:04 +02:00
|
|
|
use Illuminate\Http\JsonResponse;
|
2020-05-14 03:04:23 +02:00
|
|
|
|
|
|
|
class PaymentRefundFailed extends Exception
|
2020-09-06 11:38:10 +02:00
|
|
|
{
|
2020-05-14 03:04:23 +02:00
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Report the exception.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function report()
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
2020-05-14 03:04:23 +02:00
|
|
|
|
2020-09-06 11:38:10 +02:00
|
|
|
/**
|
|
|
|
* Render the exception into an HTTP response.
|
|
|
|
*
|
2020-10-28 11:10:49 +01:00
|
|
|
* @param Request $request
|
2023-07-25 12:04:04 +02:00
|
|
|
* @return JsonResponse
|
2020-09-06 11:38:10 +02:00
|
|
|
*/
|
|
|
|
public function render($request)
|
|
|
|
{
|
2021-08-25 06:36:30 +02:00
|
|
|
// $msg = 'Unable to refund the transaction';
|
|
|
|
$msg = ctrans('texts.warning_local_refund');
|
|
|
|
|
2023-07-25 12:04:04 +02:00
|
|
|
if ($this->getMessage() && strlen($this->getMessage()) > 1) {
|
2021-08-25 06:36:30 +02:00
|
|
|
$msg = $this->getMessage();
|
2022-06-21 11:57:17 +02:00
|
|
|
}
|
2021-08-25 06:36:30 +02:00
|
|
|
|
2020-09-06 11:38:10 +02:00
|
|
|
return response()->json([
|
2022-06-21 11:57:17 +02:00
|
|
|
'message' => $msg,
|
|
|
|
], 401);
|
2020-09-06 11:38:10 +02:00
|
|
|
}
|
2020-05-14 03:04:23 +02:00
|
|
|
}
|