chore: initial import for test contour
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service\Client;
|
||||
|
||||
use App\Service\Client\AbstractHttpClientService;
|
||||
use App\Service\Client\Interfaces\SmartCaptchaClientServiceInterface;
|
||||
|
||||
final class SmartCaptchaClientService extends AbstractHttpClientService implements SmartCaptchaClientServiceInterface
|
||||
{
|
||||
private string $secret;
|
||||
|
||||
public function __construct(string $userAgent, string $baseUrl, string $secret)
|
||||
{
|
||||
parent::__construct($userAgent, $baseUrl);
|
||||
|
||||
$this->secret = $secret;
|
||||
}
|
||||
|
||||
public function validate(string $token, string $clientIp): array
|
||||
{
|
||||
$options = [
|
||||
'query' => [
|
||||
"secret" => $this->secret,
|
||||
"token" => $token,
|
||||
"ip" => $clientIp,
|
||||
]
|
||||
];
|
||||
|
||||
$httpResponse = $this->request('POST', '/validate', $options);
|
||||
|
||||
return $httpResponse->toArray();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user