mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 20:43:56 +00:00
37 lines
1.0 KiB
PHP
37 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Segments\Processors;
|
|
|
|
|
|
use App\Classes\Modules\Companies\Processors\AssignSegmentProcessor;
|
|
use App\Models\User;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use TimeHunter\LaravelGoogleReCaptchaV3\Core\GoogleReCaptchaV3Response;
|
|
use TimeHunter\LaravelGoogleReCaptchaV3\Facades\GoogleReCaptchaV3;
|
|
|
|
class RiskAnalysisProcessor
|
|
{
|
|
|
|
/** @var AssignSegmentProcessor */
|
|
private $assignSegmentProcessor;
|
|
|
|
/**
|
|
* RiskAnalysisProcessor constructor.
|
|
* @param AssignSegmentProcessor $assignSegmentProcessor
|
|
*/
|
|
public function __construct(AssignSegmentProcessor $assignSegmentProcessor)
|
|
{
|
|
$this->assignSegmentProcessor = $assignSegmentProcessor;
|
|
}
|
|
|
|
|
|
function execute(User $user, string $token){
|
|
$captchaToken = GoogleReCaptchaV3::verifyResponse($token);
|
|
|
|
if($captchaToken->getScore() < 0.6 && !in_array('timeout-or-duplicate', $captchaToken->getErrorCodes())){
|
|
$this->assignSegmentProcessor->execute($user->company()->first(), 18);
|
|
}
|
|
}
|
|
|
|
} |