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