diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 338e991da01b..5f339dc293fe 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -23,6 +23,7 @@ use App\Libraries\MultiDB; use App\Libraries\OAuth\OAuth; use App\Libraries\OAuth\Providers\Google; use App\Models\Client; +use App\Models\Company; use App\Models\CompanyToken; use App\Models\CompanyUser; use App\Models\SystemLog; @@ -236,11 +237,12 @@ class LoginController extends BaseController ->batch(); SystemLogger::dispatch( - request()->getClientIp(), + json_encode(['id' => request()->getClientIp()]), SystemLog::CATEGORY_SECURITY, SystemLog::EVENT_USER, SystemLog::TYPE_LOGIN_FAILURE, - Client::first(), + null, + Company::first(), ); $this->incrementLoginAttempts($request); diff --git a/app/Http/Controllers/ClientPortal/PaymentController.php b/app/Http/Controllers/ClientPortal/PaymentController.php index e768163aca00..bc2199738730 100644 --- a/app/Http/Controllers/ClientPortal/PaymentController.php +++ b/app/Http/Controllers/ClientPortal/PaymentController.php @@ -290,7 +290,8 @@ class PaymentController extends Controller SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_ERROR, SystemLog::TYPE_FAILURE, - auth('contact')->user()->client + auth('contact')->user()->client, + auth('contact')->user()->client->company ); throw new PaymentFailed($e->getMessage()); diff --git a/app/Http/Controllers/PostMarkController.php b/app/Http/Controllers/PostMarkController.php index 7a98a59f1adc..1a6fd03126d5 100644 --- a/app/Http/Controllers/PostMarkController.php +++ b/app/Http/Controllers/PostMarkController.php @@ -125,7 +125,13 @@ class PostMarkController extends BaseController $this->invitation->email_status = 'delivered'; $this->invitation->save(); - SystemLogger::dispatch($request->all(), SystemLog::CATEGORY_MAIL, SystemLog::EVENT_MAIL_DELIVERY, SystemLog::TYPE_WEBHOOK_RESPONSE, $this->invitation->contact->client); + SystemLogger::dispatch($request->all(), + SystemLog::CATEGORY_MAIL, + SystemLog::EVENT_MAIL_DELIVERY, + SystemLog::TYPE_WEBHOOK_RESPONSE, + $this->invitation->contact->client, + $this->invitation->company + ); } // { @@ -167,7 +173,7 @@ class PostMarkController extends BaseController LightLogs::create($bounce)->batch(); - SystemLogger::dispatch($request->all(), SystemLog::CATEGORY_MAIL, SystemLog::EVENT_MAIL_BOUNCED, SystemLog::TYPE_WEBHOOK_RESPONSE, $this->invitation->contact->client); + SystemLogger::dispatch($request->all(), SystemLog::CATEGORY_MAIL, SystemLog::EVENT_MAIL_BOUNCED, SystemLog::TYPE_WEBHOOK_RESPONSE, $this->invitation->contact->client, $this->invitation->company); } // { @@ -209,7 +215,7 @@ class PostMarkController extends BaseController LightLogs::create($bounce)->batch(); - SystemLogger::dispatch($request->all(), SystemLog::CATEGORY_MAIL, SystemLog::EVENT_MAIL_SPAM_COMPLAINT, SystemLog::TYPE_WEBHOOK_RESPONSE, $this->invitation->contact->client); + SystemLogger::dispatch($request->all(), SystemLog::CATEGORY_MAIL, SystemLog::EVENT_MAIL_SPAM_COMPLAINT, SystemLog::TYPE_WEBHOOK_RESPONSE, $this->invitation->contact->client, $this->invitation->company); } private function discoverInvitation($message_id) diff --git a/app/Jobs/Mail/NinjaMailerJob.php b/app/Jobs/Mail/NinjaMailerJob.php index 8278b7eecb25..879057ff3409 100644 --- a/app/Jobs/Mail/NinjaMailerJob.php +++ b/app/Jobs/Mail/NinjaMailerJob.php @@ -222,7 +222,8 @@ class NinjaMailerJob implements ShouldQueue SystemLog::CATEGORY_MAIL, SystemLog::EVENT_MAIL_SEND, SystemLog::TYPE_FAILURE, - $recipient_object + $recipient_object, + $this->nmo->company ); } diff --git a/app/Jobs/Util/SystemLogger.php b/app/Jobs/Util/SystemLogger.php index 150984b400f9..3891350b219e 100644 --- a/app/Jobs/Util/SystemLogger.php +++ b/app/Jobs/Util/SystemLogger.php @@ -11,7 +11,9 @@ namespace App\Jobs\Util; +use App\Libraries\MultiDB; use App\Models\Client; +use App\Models\Company; use App\Models\SystemLog; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; @@ -33,7 +35,9 @@ class SystemLogger implements ShouldQueue protected $client; - public function __construct($log, $category_id, $event_id, $type_id, ?Client $client) + protected $company; + + public function __construct($log, $category_id, $event_id, $type_id, ?Client $client, Company $company) { $this->log = $log; $this->category_id = $category_id; @@ -44,13 +48,16 @@ class SystemLogger implements ShouldQueue public function handle() :void { - if(!$this->client) - return; + + MultiDB::setDb($this->company->db); + + $client_id = $this->client ? $this->client->id : null; + $user_id = $this->client ? $this->client->user_id : $this->company->owner()->id; $sl = [ - 'client_id' => $this->client->id, - 'company_id' => $this->client->company->id, - 'user_id' => $this->client->user_id, + 'client_id' => $client_id, + 'company_id' => $this->company->id, + 'user_id' => $user_id, 'log' => $this->log, 'category_id' => $this->category_id, 'event_id' => $this->event_id, diff --git a/app/Jobs/Util/WebhookHandler.php b/app/Jobs/Util/WebhookHandler.php index df86c38ed918..970ecc07de86 100644 --- a/app/Jobs/Util/WebhookHandler.php +++ b/app/Jobs/Util/WebhookHandler.php @@ -123,6 +123,7 @@ class WebhookHandler implements ShouldQueue SystemLog::EVENT_WEBHOOK_RESPONSE, SystemLog::TYPE_WEBHOOK_RESPONSE, $this->company->clients->first(), + $this->company ); } @@ -136,6 +137,7 @@ class WebhookHandler implements ShouldQueue SystemLog::EVENT_WEBHOOK_RESPONSE, SystemLog::TYPE_WEBHOOK_RESPONSE, $this->company->clients->first(), + $this->company, ); } diff --git a/app/Listeners/User/UpdateUserLastLogin.php b/app/Listeners/User/UpdateUserLastLogin.php index fa087be5e4a3..e6f10fabff57 100644 --- a/app/Listeners/User/UpdateUserLastLogin.php +++ b/app/Listeners/User/UpdateUserLastLogin.php @@ -75,6 +75,7 @@ class UpdateUserLastLogin implements ShouldQueue SystemLog::EVENT_USER, SystemLog::TYPE_LOGIN_SUCCESS, $event->company->clients()->first(), + $event->company, ); } diff --git a/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php b/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php index 67903e2309d2..a8129d121b06 100644 --- a/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php +++ b/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php @@ -136,7 +136,7 @@ class AuthorizeCreditCard PaymentFailureMailer::dispatch($this->authorize->client, $response->getTransactionResponse()->getTransId(), $this->authorize->client->company, $amount); - SystemLogger::dispatch($logger_message, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client); + SystemLogger::dispatch($logger_message, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client, $this->authorize->client->company); return false; } @@ -192,7 +192,8 @@ class AuthorizeCreditCard SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_AUTHORIZE, - $this->authorize->client + $this->authorize->client, + $this->authorize->client->company, ); return redirect()->route('client.payments.show', ['payment' => $this->encodePrimaryKey($payment->id)]); diff --git a/app/PaymentDrivers/Authorize/RefundTransaction.php b/app/PaymentDrivers/Authorize/RefundTransaction.php index 7b07e1578f83..0c53620b8306 100644 --- a/app/PaymentDrivers/Authorize/RefundTransaction.php +++ b/app/PaymentDrivers/Authorize/RefundTransaction.php @@ -86,7 +86,7 @@ class RefundTransaction 'amount' => $amount, ]; - SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_AUTHORIZE, $this->authorize->client); + SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_AUTHORIZE, $this->authorize->client, $this->authorize->client->company); return $data; @@ -105,7 +105,7 @@ class RefundTransaction 'amount' => $amount, ]; - SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client); + SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client, $this->authorize->client->company); return $data; } @@ -125,7 +125,7 @@ class RefundTransaction 'amount' => $amount, ]; - SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client); + SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client, $this->authorize->client->company); return $data; @@ -141,7 +141,7 @@ class RefundTransaction 'amount' => $amount, ]; - SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client); + SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client, $this->authorize->client->company); return $data; } @@ -158,7 +158,7 @@ class RefundTransaction 'amount' => $amount, ]; - SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client); + SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client, $this->authorize->client->company); return $data; } @@ -173,7 +173,7 @@ class RefundTransaction 'amount' => $amount, ]; - SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client); + SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client, $this->authorize->client->company); } } diff --git a/app/PaymentDrivers/BaseDriver.php b/app/PaymentDrivers/BaseDriver.php index 534201dbc80b..96352f0c3d50 100644 --- a/app/PaymentDrivers/BaseDriver.php +++ b/app/PaymentDrivers/BaseDriver.php @@ -394,6 +394,7 @@ class BaseDriver extends AbstractPaymentDriver SystemLog::EVENT_GATEWAY_ERROR, $gateway::SYSTEM_LOG_TYPE, $gateway->client, + $gateway->client->company, ); throw new PaymentFailed($error, $e->getCode()); @@ -527,6 +528,7 @@ class BaseDriver extends AbstractPaymentDriver SystemLog::EVENT_GATEWAY_SUCCESS, $gateway_const, $this->client, + $this->client->company, ); } } diff --git a/app/PaymentDrivers/Braintree/CreditCard.php b/app/PaymentDrivers/Braintree/CreditCard.php index 0006ea42cbd8..4d72ab0e9901 100644 --- a/app/PaymentDrivers/Braintree/CreditCard.php +++ b/app/PaymentDrivers/Braintree/CreditCard.php @@ -149,7 +149,8 @@ class CreditCard SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_BRAINTREE, - $this->braintree->client + $this->braintree->client, + $this->braintree->client->company, ); return redirect()->route('client.payments.show', ['payment' => $this->braintree->encodePrimaryKey($payment->id)]); @@ -179,7 +180,8 @@ class CreditCard SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_BRAINTREE, - $this->braintree->client + $this->braintree->client, + $this->braintree->client->company, ); throw new PaymentFailed($response->transaction->additionalProcessorResponse, $response->transaction->processorResponseCode); diff --git a/app/PaymentDrivers/CheckoutCom/Utilities.php b/app/PaymentDrivers/CheckoutCom/Utilities.php index cdfc171d3945..6f61c2ac0b94 100644 --- a/app/PaymentDrivers/CheckoutCom/Utilities.php +++ b/app/PaymentDrivers/CheckoutCom/Utilities.php @@ -76,7 +76,8 @@ trait Utilities SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_CHECKOUT, - $this->getParent()->client + $this->getParent()->client, + $this->getParent()->client->company ); return redirect()->route('client.payments.show', ['payment' => $this->getParent()->encodePrimaryKey($payment->id)]); @@ -101,7 +102,8 @@ trait Utilities SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_CHECKOUT, - $this->getParent()->client + $this->getParent()->client, + $this->getParent()->client->company, ); if ($throw_exception) { diff --git a/app/PaymentDrivers/CheckoutComPaymentDriver.php b/app/PaymentDrivers/CheckoutComPaymentDriver.php index ab8a41ab4a3d..1e9b041fab22 100644 --- a/app/PaymentDrivers/CheckoutComPaymentDriver.php +++ b/app/PaymentDrivers/CheckoutComPaymentDriver.php @@ -282,7 +282,7 @@ class CheckoutComPaymentDriver extends BaseDriver 'message' => $message, ]; - SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_CHECKOUT, $this->client); + SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_CHECKOUT, $this->client, $this->client->company); } } diff --git a/app/PaymentDrivers/PayPalExpressPaymentDriver.php b/app/PaymentDrivers/PayPalExpressPaymentDriver.php index fc2fc6ee89d9..d62c0b6f61a3 100644 --- a/app/PaymentDrivers/PayPalExpressPaymentDriver.php +++ b/app/PaymentDrivers/PayPalExpressPaymentDriver.php @@ -106,7 +106,8 @@ class PayPalExpressPaymentDriver extends BaseDriver SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_PAYPAL, - $this->client + $this->client, + $this->client->company, ); throw new PaymentFailed($response->getMessage(), $response->getCode()); @@ -140,7 +141,8 @@ class PayPalExpressPaymentDriver extends BaseDriver SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_PAYPAL, - $this->client + $this->client, + $this->client->company, ); return redirect()->route('client.payments.show', ['payment' => $this->encodePrimaryKey($payment->id)]); @@ -162,7 +164,8 @@ class PayPalExpressPaymentDriver extends BaseDriver SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_PAYPAL, - $this->client + $this->client, + $this->client->company, ); throw new PaymentFailed($response->getMessage(), $response->getCode()); diff --git a/app/PaymentDrivers/Stripe/Alipay.php b/app/PaymentDrivers/Stripe/Alipay.php index f923c9e2a5de..5b10bfeb978f 100644 --- a/app/PaymentDrivers/Stripe/Alipay.php +++ b/app/PaymentDrivers/Stripe/Alipay.php @@ -87,7 +87,8 @@ class Alipay SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_STRIPE, - $this->stripe->client + $this->stripe->client, + $this->stripe->client->company, ); return redirect()->route('client.payments.show', ['payment' => $this->stripe->encodePrimaryKey($payment->id)]); @@ -116,7 +117,8 @@ class Alipay SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, - $this->stripe->client + $this->stripe->client, + $this->stripe->client->company, ); throw new PaymentFailed('Failed to process the payment.', 500); diff --git a/app/PaymentDrivers/Stripe/Charge.php b/app/PaymentDrivers/Stripe/Charge.php index 5cbc4c96da08..82d18a171dd9 100644 --- a/app/PaymentDrivers/Stripe/Charge.php +++ b/app/PaymentDrivers/Stripe/Charge.php @@ -79,7 +79,7 @@ class Charge $response = $this->stripe->createPaymentIntent($data, $this->stripe->stripe_connect_auth); // $response = $local_stripe->paymentIntents->create($data); - SystemLogger::dispatch($response, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_STRIPE, $this->stripe->client); + SystemLogger::dispatch($response, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_STRIPE, $this->stripe->client, $this->stripe->client->company); } catch (\Exception $e) { $data =[ @@ -119,7 +119,7 @@ class Charge $this->stripe->processInternallyFailedPayment($this->stripe, $e); - SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->stripe->client); + SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->stripe->client, $this->stripe->client->company); } if (! $response) { diff --git a/app/PaymentDrivers/Stripe/CreditCard.php b/app/PaymentDrivers/Stripe/CreditCard.php index 696d7654a9a2..20a59091e181 100644 --- a/app/PaymentDrivers/Stripe/CreditCard.php +++ b/app/PaymentDrivers/Stripe/CreditCard.php @@ -141,7 +141,8 @@ class CreditCard SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_STRIPE, - $this->stripe->client + $this->stripe->client, + $this->stripe->client->company, ); return redirect()->route('client.payments.show', ['payment' => $this->stripe->encodePrimaryKey($payment->id)]); @@ -168,7 +169,8 @@ class CreditCard SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, - $this->stripe->client + $this->stripe->client, + $this->stripe->client->company, ); throw new PaymentFailed('Failed to process the payment.', 500); diff --git a/app/PaymentDrivers/Stripe/SOFORT.php b/app/PaymentDrivers/Stripe/SOFORT.php index 77d6e63a57d8..f5d27d3b151d 100644 --- a/app/PaymentDrivers/Stripe/SOFORT.php +++ b/app/PaymentDrivers/Stripe/SOFORT.php @@ -92,7 +92,8 @@ class SOFORT SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_STRIPE, - $this->stripe->client + $this->stripe->client, + $this->stripe->client->company, ); return redirect()->route('client.payments.show', ['payment' => $this->stripe->encodePrimaryKey($payment->id)]); @@ -119,7 +120,8 @@ class SOFORT SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, - $this->stripe->client + $this->stripe->client, + $this->stripe->client->company, ); throw new PaymentFailed('Failed to process the payment.', 500); diff --git a/app/PaymentDrivers/StripePaymentDriver.php b/app/PaymentDrivers/StripePaymentDriver.php index bfbd5df65618..3c7dad302b8c 100644 --- a/app/PaymentDrivers/StripePaymentDriver.php +++ b/app/PaymentDrivers/StripePaymentDriver.php @@ -338,7 +338,7 @@ class StripePaymentDriver extends BaseDriver ->create(['charge' => $payment->transaction_reference, 'amount' => $this->convertToStripeAmount($amount, $this->client->currency()->precision)], $meta); if ($response->status == $response::STATUS_SUCCEEDED) { - SystemLogger::dispatch(['server_response' => $response, 'data' => request()->all(),], SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_STRIPE, $this->client); + SystemLogger::dispatch(['server_response' => $response, 'data' => request()->all(),], SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_STRIPE, $this->client, $this->client->company); return [ 'transaction_reference' => $response->charge, @@ -349,7 +349,7 @@ class StripePaymentDriver extends BaseDriver ]; } - SystemLogger::dispatch(['server_response' => $response, 'data' => request()->all(),], SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->client); + SystemLogger::dispatch(['server_response' => $response, 'data' => request()->all(),], SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->client, $this->client->company); return [ 'transaction_reference' => null, @@ -359,7 +359,7 @@ class StripePaymentDriver extends BaseDriver 'code' => 422, ]; } catch (Exception $e) { - SystemLogger::dispatch(['server_response' => $response, 'data' => request()->all(),], SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->client); + SystemLogger::dispatch(['server_response' => $response, 'data' => request()->all(),], SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->client, $this->client->company); nlog($e->getMessage()); @@ -426,7 +426,7 @@ class StripePaymentDriver extends BaseDriver SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, - $this->client); + $this->client, $this->client->company); } } @@ -459,7 +459,7 @@ class StripePaymentDriver extends BaseDriver SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, - $this->client); + $this->client, $this->client->company); } } diff --git a/app/Services/Subscription/SubscriptionService.php b/app/Services/Subscription/SubscriptionService.php index e804b404cae7..640ba7f43acc 100644 --- a/app/Services/Subscription/SubscriptionService.php +++ b/app/Services/Subscription/SubscriptionService.php @@ -664,7 +664,8 @@ class SubscriptionService SystemLog::CATEGORY_WEBHOOK, SystemLog::EVENT_WEBHOOK_RESPONSE, SystemLog::TYPE_WEBHOOK_RESPONSE, - $client, + $client, + $client->company, ); return $response; diff --git a/app/Utils/PhantomJS/Phantom.php b/app/Utils/PhantomJS/Phantom.php index a9efb57941fd..d6729e914c15 100644 --- a/app/Utils/PhantomJS/Phantom.php +++ b/app/Utils/PhantomJS/Phantom.php @@ -125,7 +125,8 @@ class Phantom SystemLog::CATEGORY_PDF, SystemLog::EVENT_PDF_RESPONSE, SystemLog::TYPE_PDF_FAILURE, - $invitation->contact->client + $invitation->contact->client, + $invitation->company, ); throw new PhantomPDFFailure('There was an error generating the PDF with Phantom JS'); @@ -137,7 +138,8 @@ class Phantom SystemLog::CATEGORY_PDF, SystemLog::EVENT_PDF_RESPONSE, SystemLog::TYPE_PDF_SUCCESS, - $invitation->contact->client + $invitation->contact->client, + $invitation->company, ); }