2021-05-31 16:23:18 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2024-04-12 06:15:41 +02:00
|
|
|
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
|
2021-05-31 16:23:18 +02:00
|
|
|
*
|
2021-06-16 08:58:16 +02:00
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
2021-05-31 16:23:18 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Gateways;
|
|
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
2021-05-31 16:37:46 +02:00
|
|
|
use App\Http\Requests\Gateways\Checkout3ds\Checkout3dsRequest;
|
2021-05-31 16:23:18 +02:00
|
|
|
|
|
|
|
class Checkout3dsController extends Controller
|
|
|
|
{
|
2021-05-31 16:37:46 +02:00
|
|
|
public function index(Checkout3dsRequest $request, string $company_key, string $company_gateway_id, string $hash)
|
2021-05-31 16:23:18 +02:00
|
|
|
{
|
2022-06-21 11:57:17 +02:00
|
|
|
if (! $request->getCompany()) {
|
2021-06-01 11:54:15 +02:00
|
|
|
return response()->json(['message' => 'Company record not found.', 'company_key' => $company_key]);
|
|
|
|
}
|
|
|
|
|
2022-06-21 11:57:17 +02:00
|
|
|
if (! $request->getCompanyGateway()) {
|
2021-06-01 11:54:15 +02:00
|
|
|
return response()->json(['message' => 'Company gateway record not found.', 'company_gateway_id' => $company_gateway_id]);
|
|
|
|
}
|
|
|
|
|
2022-06-21 11:57:17 +02:00
|
|
|
if (! $request->getPaymentHash()) {
|
2021-06-01 11:54:15 +02:00
|
|
|
return response()->json(['message' => 'Hash record not found.', 'hash' => $hash]);
|
|
|
|
}
|
|
|
|
|
2022-06-21 11:57:17 +02:00
|
|
|
if (! $request->getClient()) {
|
2021-06-01 11:54:15 +02:00
|
|
|
return response()->json(['message' => 'Client record not found.']);
|
|
|
|
}
|
|
|
|
|
2021-05-31 16:37:46 +02:00
|
|
|
return $request->getCompanyGateway()
|
|
|
|
->driver($request->getClient())
|
|
|
|
->process3dsConfirmation($request);
|
2021-05-31 16:23:18 +02:00
|
|
|
}
|
|
|
|
}
|