|
@@ -7,9 +7,11 @@ use Symfony\Contracts\HttpClient\HttpClientInterface;
|
|
|
|
|
|
final class Client {
|
|
final class Client {
|
|
private HttpClientInterface $client;
|
|
private HttpClientInterface $client;
|
|
|
|
+ private ClientConfig $clientConfig;
|
|
private object $auth;
|
|
private object $auth;
|
|
|
|
|
|
- public function __construct(private ClientConfig $clientConfig) {
|
|
|
|
|
|
+ public function __construct(ClientConfig $clientConfig) {
|
|
|
|
+ $this->clientConfig = $clientConfig;
|
|
$this->client = HttpClient::create(
|
|
$this->client = HttpClient::create(
|
|
[
|
|
[
|
|
'headers' => [
|
|
'headers' => [
|
|
@@ -44,10 +46,15 @@ final class Client {
|
|
$result['access_token'],
|
|
$result['access_token'],
|
|
$result['token_type']
|
|
$result['token_type']
|
|
) {
|
|
) {
|
|
|
|
+ private string $token;
|
|
|
|
+ private string $type;
|
|
public function __construct(
|
|
public function __construct(
|
|
- private string $token,
|
|
|
|
- private string $type,
|
|
|
|
- ) {}
|
|
|
|
|
|
+ string $token,
|
|
|
|
+ string $type
|
|
|
|
+ ) {
|
|
|
|
+ $this->token = $token;
|
|
|
|
+ $this->type = $type;
|
|
|
|
+ }
|
|
|
|
|
|
public function getHeader(): string {
|
|
public function getHeader(): string {
|
|
return sprintf("%s %s", $this->type, $this->token);
|
|
return sprintf("%s %s", $this->type, $this->token);
|
|
@@ -64,7 +71,7 @@ final class Client {
|
|
}
|
|
}
|
|
|
|
|
|
public function orderProspectus(
|
|
public function orderProspectus(
|
|
- Prospectus $prospectus,
|
|
|
|
|
|
+ Prospectus $prospectus
|
|
): bool {
|
|
): bool {
|
|
$ret = $this->getAuthClient()->request(
|
|
$ret = $this->getAuthClient()->request(
|
|
"POST",
|
|
"POST",
|
|
@@ -73,18 +80,6 @@ final class Client {
|
|
]
|
|
]
|
|
);
|
|
);
|
|
var_dump($ret->getContent(false));
|
|
var_dump($ret->getContent(false));
|
|
-
|
|
|
|
- // var_dump($params, $this, $this->getAuthClient());
|
|
|
|
- //
|
|
|
|
- // $this->getAuthClient()->request(
|
|
|
|
- // 'POST',
|
|
|
|
- // $this->getUrl(
|
|
|
|
- // $this->clientConfig->get()->endpoint,
|
|
|
|
- // "/api/v1/autoprospect/orderprospect"
|
|
|
|
- // ), [
|
|
|
|
- // 'json' => $params
|
|
|
|
- // ]
|
|
|
|
- // );
|
|
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|