diff --git a/app/Http/Requests/Payments/PaymentWebhookRequest.php b/app/Http/Requests/Payments/PaymentWebhookRequest.php index ef805d1367bd..eb6bf11a5b8c 100644 --- a/app/Http/Requests/Payments/PaymentWebhookRequest.php +++ b/app/Http/Requests/Payments/PaymentWebhookRequest.php @@ -27,8 +27,6 @@ class PaymentWebhookRequest extends Request public function authorize() { - MultiDB::findAndSetDbByCompanyKey($this->company_key); - return true; } @@ -47,6 +45,8 @@ class PaymentWebhookRequest extends Request */ public function getCompanyGateway() { + MultiDB::findAndSetDbByCompanyKey($this->company_key); + return CompanyGateway::withTrashed()->findOrFail($this->decodePrimaryKey($this->company_gateway_id)); } @@ -59,6 +59,9 @@ class PaymentWebhookRequest extends Request public function getPaymentHash() { if ($this->query('hash')) { + + MultiDB::findAndSetDbByCompanyKey($this->company_key); + return PaymentHash::where('hash', $this->query('hash'))->firstOrFail(); } @@ -72,6 +75,8 @@ class PaymentWebhookRequest extends Request */ public function getCompany(): ?Company { + MultiDB::findAndSetDbByCompanyKey($this->company_key); + return Company::where('company_key', $this->company_key)->firstOrFail(); } } diff --git a/app/PaymentDrivers/MolliePaymentDriver.php b/app/PaymentDrivers/MolliePaymentDriver.php index f13c747e9480..bab3adcf2e59 100644 --- a/app/PaymentDrivers/MolliePaymentDriver.php +++ b/app/PaymentDrivers/MolliePaymentDriver.php @@ -304,6 +304,8 @@ class MolliePaymentDriver extends BaseDriver 'paid' => Payment::STATUS_COMPLETED, ]; + nlog($request->id); + try { $payment = $this->gateway->payments->get($request->id); $record = Payment::withTrashed()->where('transaction_reference', $request->id)->first();