forked from apoloz/alfa-bank-sdk
40 lines
990 B
PHP
40 lines
990 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Apoloz\AlfaBank\Requests\DebitCards;
|
|
|
|
use Apoloz\AlfaBank\Data\DebitCards\DebitCardApplicationData;
|
|
use Apoloz\AlfaBank\Data\DebitCards\DebitCardApplicationResponseData;
|
|
use Saloon\Contracts\Body\HasBody;
|
|
use Saloon\Enums\Method;
|
|
use Saloon\Http\Request;
|
|
use Saloon\Http\Response;
|
|
use Saloon\Traits\Body\HasJsonBody;
|
|
|
|
class CreateDebitCardApplicationRequest extends Request implements HasBody
|
|
{
|
|
use HasJsonBody;
|
|
|
|
protected Method $method = Method::POST;
|
|
|
|
public function __construct(
|
|
protected DebitCardApplicationData $data
|
|
) {}
|
|
|
|
public function resolveEndpoint(): string
|
|
{
|
|
return '/api/pp/v1/debit-cards/application';
|
|
}
|
|
|
|
public function createDtoFromResponse(Response $response): DebitCardApplicationResponseData
|
|
{
|
|
return DebitCardApplicationResponseData::from($response->json());
|
|
}
|
|
|
|
protected function defaultBody(): array
|
|
{
|
|
return $this->data->toArray();
|
|
}
|
|
}
|