36 lines
795 B
PHP
36 lines
795 B
PHP
<?php
|
|
|
|
namespace Apoloz\AlfaBank\Requests\B2B_1C;
|
|
|
|
use Apoloz\AlfaBank\Data\B2B_1C\MerchantData;
|
|
use Saloon\Enums\Method;
|
|
use Saloon\Http\Request;
|
|
use Saloon\Http\Response;
|
|
|
|
class CheckMerchantRequest extends Request
|
|
{
|
|
protected Method $method = Method::GET;
|
|
|
|
public function __construct(
|
|
protected string $merchantId,
|
|
protected string $auth1C // Basic auth string
|
|
) {}
|
|
|
|
public function resolveEndpoint(): string
|
|
{
|
|
return "/api/1c/merchants/{$this->merchantId}";
|
|
}
|
|
|
|
protected function defaultHeaders(): array
|
|
{
|
|
return [
|
|
'Authorization-1C' => $this->auth1C,
|
|
];
|
|
}
|
|
|
|
public function createDtoFromResponse(Response $response): MerchantData
|
|
{
|
|
return MerchantData::from($response->json());
|
|
}
|
|
}
|