2020-06-27 15:53:12 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
2020-06-27 15:53:12 +02:00
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2021-01-03 22:54:54 +01:00
|
|
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
2020-06-27 15:53:12 +02:00
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
use App\Http\Requests\Payments\PaymentWebhookRequest;
|
2021-04-22 13:53:21 +02:00
|
|
|
use App\Libraries\MultiDB;
|
|
|
|
use Auth;
|
2020-06-27 15:53:12 +02:00
|
|
|
|
|
|
|
class PaymentWebhookController extends Controller
|
|
|
|
{
|
2020-12-17 12:47:46 +01:00
|
|
|
public function __invoke(PaymentWebhookRequest $request, string $company_key, string $company_gateway_id)
|
2020-06-27 15:53:12 +02:00
|
|
|
{
|
2021-04-22 14:56:00 +02:00
|
|
|
|
2021-04-22 13:53:21 +02:00
|
|
|
MultiDB::findAndSetDbByCompanyKey($company_key);
|
|
|
|
|
2020-12-16 15:25:42 +01:00
|
|
|
$payment = $request->getPayment();
|
2020-12-17 12:27:15 +01:00
|
|
|
$client = is_null($payment) ? $request->getClient() : $payment->client;
|
2020-12-16 15:25:42 +01:00
|
|
|
|
2021-04-22 13:53:21 +02:00
|
|
|
// $contact= $client->primary_contact()->first();
|
|
|
|
// Auth::guard('contact')->login($contact, true);
|
|
|
|
|
2020-12-07 14:49:30 +01:00
|
|
|
return $request->getCompanyGateway()
|
2020-12-17 12:27:15 +01:00
|
|
|
->driver($client)
|
2020-12-16 15:25:42 +01:00
|
|
|
->processWebhookRequest($request, $payment);
|
2020-06-27 15:53:12 +02:00
|
|
|
}
|
|
|
|
}
|