mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #7711 from kishanmnpatel/system_logger_for_forte
System logger added for Forte.
This commit is contained in:
commit
3b136a7539
@ -73,6 +73,7 @@ class CompanyGateway extends BaseModel
|
|||||||
// const TYPE_WEPAY = 309;
|
// const TYPE_WEPAY = 309;
|
||||||
// const TYPE_PAYFAST = 310;
|
// const TYPE_PAYFAST = 310;
|
||||||
// const TYPE_PAYTRACE = 311;
|
// const TYPE_PAYTRACE = 311;
|
||||||
|
// const TYPE_FORTE = 314;
|
||||||
|
|
||||||
public $gateway_consts = [
|
public $gateway_consts = [
|
||||||
'38f2c48af60c7dd69e04248cbb24c36e' => 300,
|
'38f2c48af60c7dd69e04248cbb24c36e' => 300,
|
||||||
@ -85,6 +86,7 @@ class CompanyGateway extends BaseModel
|
|||||||
'8fdeed552015b3c7b44ed6c8ebd9e992' => 309,
|
'8fdeed552015b3c7b44ed6c8ebd9e992' => 309,
|
||||||
'd6814fc83f45d2935e7777071e629ef9' => 310,
|
'd6814fc83f45d2935e7777071e629ef9' => 310,
|
||||||
'bbd736b3254b0aabed6ad7fda1298c88' => 311,
|
'bbd736b3254b0aabed6ad7fda1298c88' => 311,
|
||||||
|
'kivcvjexxvdiyqtj3mju5d6yhpeht2xs' => 314,
|
||||||
'65faab2ab6e3223dbe848b1686490baz' => 320,
|
'65faab2ab6e3223dbe848b1686490baz' => 320,
|
||||||
'b9886f9257f0c6ee7c302f1c74475f6c' => 321,
|
'b9886f9257f0c6ee7c302f1c74475f6c' => 321,
|
||||||
'hxd6gwg3ekb9tb3v9lptgx1mqyg69zu9' => 322,
|
'hxd6gwg3ekb9tb3v9lptgx1mqyg69zu9' => 322,
|
||||||
|
@ -100,6 +100,8 @@ class SystemLog extends Model
|
|||||||
const TYPE_MOLLIE = 312;
|
const TYPE_MOLLIE = 312;
|
||||||
|
|
||||||
const TYPE_EWAY = 313;
|
const TYPE_EWAY = 313;
|
||||||
|
|
||||||
|
const TYPE_FORTE = 314;
|
||||||
|
|
||||||
const TYPE_SQUARE = 320;
|
const TYPE_SQUARE = 320;
|
||||||
|
|
||||||
@ -250,7 +252,9 @@ class SystemLog extends Model
|
|||||||
case self::TYPE_WEPAY:
|
case self::TYPE_WEPAY:
|
||||||
return 'WePay';
|
return 'WePay';
|
||||||
case self::TYPE_PAYFAST:
|
case self::TYPE_PAYFAST:
|
||||||
return 'Payfast';
|
return "Payfast";
|
||||||
|
case self::TYPE_FORTE:
|
||||||
|
return "Forte";
|
||||||
default:
|
default:
|
||||||
return 'undefined';
|
return 'undefined';
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,8 @@ use App\Http\Requests\Request;
|
|||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
use App\PaymentDrivers\FortePaymentDriver;
|
use App\PaymentDrivers\FortePaymentDriver;
|
||||||
|
use App\Jobs\Util\SystemLogger;
|
||||||
|
use App\Models\SystemLog;
|
||||||
|
|
||||||
class ACH
|
class ACH
|
||||||
{
|
{
|
||||||
@ -129,13 +131,36 @@ class ACH
|
|||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
throw $th;
|
throw $th;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$message = [
|
||||||
|
'server_message' => $response->response->response_desc,
|
||||||
|
'server_response' => $response,
|
||||||
|
'data' => $payment_hash->data,
|
||||||
|
];
|
||||||
|
|
||||||
if ($httpcode>299) {
|
if ($httpcode>299) {
|
||||||
|
SystemLogger::dispatch(
|
||||||
|
$message,
|
||||||
|
SystemLog::CATEGORY_GATEWAY_RESPONSE,
|
||||||
|
SystemLog::EVENT_GATEWAY_FAILURE,
|
||||||
|
SystemLog::TYPE_FORTE,
|
||||||
|
$this->forte->client,
|
||||||
|
$this->forte->client->company,
|
||||||
|
);
|
||||||
$error = Validator::make([], []);
|
$error = Validator::make([], []);
|
||||||
$error->getMessageBag()->add('gateway_error', $response->response->response_desc);
|
$error->getMessageBag()->add('gateway_error', $response->response->response_desc);
|
||||||
return redirect('client/invoices')->withErrors($error);
|
return redirect('client/invoices')->withErrors($error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SystemLogger::dispatch(
|
||||||
|
$message,
|
||||||
|
SystemLog::CATEGORY_GATEWAY_RESPONSE,
|
||||||
|
SystemLog::EVENT_GATEWAY_SUCCESS,
|
||||||
|
SystemLog::TYPE_FORTE,
|
||||||
|
$this->forte->client,
|
||||||
|
$this->forte->client->company,
|
||||||
|
);
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'payment_method' => $request->payment_method_id,
|
'payment_method' => $request->payment_method_id,
|
||||||
'payment_type' => PaymentType::ACH,
|
'payment_type' => PaymentType::ACH,
|
||||||
|
@ -21,6 +21,8 @@ use Illuminate\Support\Facades\Session;
|
|||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
use App\PaymentDrivers\FortePaymentDriver;
|
use App\PaymentDrivers\FortePaymentDriver;
|
||||||
use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest;
|
use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest;
|
||||||
|
use App\Jobs\Util\SystemLogger;
|
||||||
|
use App\Models\SystemLog;
|
||||||
|
|
||||||
class CreditCard
|
class CreditCard
|
||||||
{
|
{
|
||||||
@ -141,12 +143,36 @@ class CreditCard
|
|||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
throw $th;
|
throw $th;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$message = [
|
||||||
|
'server_message' => $response->response->response_desc,
|
||||||
|
'server_response' => $response,
|
||||||
|
'data' => $payment_hash->data,
|
||||||
|
];
|
||||||
|
|
||||||
if ($httpcode>299) {
|
if ($httpcode>299) {
|
||||||
|
SystemLogger::dispatch(
|
||||||
|
$message,
|
||||||
|
SystemLog::CATEGORY_GATEWAY_RESPONSE,
|
||||||
|
SystemLog::EVENT_GATEWAY_FAILURE,
|
||||||
|
SystemLog::TYPE_FORTE,
|
||||||
|
$this->forte->client,
|
||||||
|
$this->forte->client->company,
|
||||||
|
);
|
||||||
$error = Validator::make([], []);
|
$error = Validator::make([], []);
|
||||||
$error->getMessageBag()->add('gateway_error', $response->response->response_desc);
|
$error->getMessageBag()->add('gateway_error', $response->response->response_desc);
|
||||||
return redirect('client/invoices')->withErrors($error);
|
return redirect('client/invoices')->withErrors($error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SystemLogger::dispatch(
|
||||||
|
$message,
|
||||||
|
SystemLog::CATEGORY_GATEWAY_RESPONSE,
|
||||||
|
SystemLog::EVENT_GATEWAY_SUCCESS,
|
||||||
|
SystemLog::TYPE_FORTE,
|
||||||
|
$this->forte->client,
|
||||||
|
$this->forte->client->company,
|
||||||
|
);
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'payment_method' => $request->payment_method_id,
|
'payment_method' => $request->payment_method_id,
|
||||||
'payment_type' => PaymentType::parseCardType(strtolower($request->card_brand)) ?: PaymentType::CREDIT_CARD_OTHER,
|
'payment_type' => PaymentType::parseCardType(strtolower($request->card_brand)) ?: PaymentType::CREDIT_CARD_OTHER,
|
||||||
|
@ -49,7 +49,7 @@ class FortePaymentDriver extends BaseDriver
|
|||||||
return $types;
|
return $types;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SYSTEM_LOG_TYPE = SystemLog::TYPE_STRIPE; //define a constant for your gateway ie TYPE_YOUR_CUSTOM_GATEWAY - set the const in the SystemLog model
|
const SYSTEM_LOG_TYPE = SystemLog::TYPE_FORTE; //define a constant for your gateway ie TYPE_YOUR_CUSTOM_GATEWAY - set the const in the SystemLog model
|
||||||
|
|
||||||
public function setPaymentMethod($payment_method_id)
|
public function setPaymentMethod($payment_method_id)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user