diff --git a/app/Http/Controllers/PaymentWebhookController.php b/app/Http/Controllers/PaymentWebhookController.php index 01b38c3abab3..67907deb5709 100644 --- a/app/Http/Controllers/PaymentWebhookController.php +++ b/app/Http/Controllers/PaymentWebhookController.php @@ -13,26 +13,14 @@ namespace App\Http\Controllers; use App\Http\Requests\Payments\PaymentWebhookRequest; -use App\Libraries\MultiDB; -use Auth; class PaymentWebhookController extends Controller { - public function __invoke(PaymentWebhookRequest $request, string $company_key, string $company_gateway_id) + public function __invoke(PaymentWebhookRequest $request) { - - $payment = $request->getPayment(); - - if(!$payment) - return response()->json(['message' => 'Payment record not found.'], 400); - - $client = is_null($payment) ? $request->getClient() : $payment->client; - - if(!$client) - return response()->json(['message' => 'Client record not found.'], 400); - - return $request->getCompanyGateway() - ->driver($client) - ->processWebhookRequest($request, $payment); + return $request + ->getCompanyGateway() + ->driver() + ->processWebhookRequest($request); } } diff --git a/app/Models/CompanyGateway.php b/app/Models/CompanyGateway.php index b9105b566e9e..f7efd1c79e2c 100644 --- a/app/Models/CompanyGateway.php +++ b/app/Models/CompanyGateway.php @@ -118,7 +118,7 @@ class CompanyGateway extends BaseModel } /* This is the public entry point into the payment superclass */ - public function driver(Client $client) + public function driver(Client $client = null) { $class = static::driver_class();