forked from apoloz/alfa-bank-sdk
42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Apoloz\AlfaBank\Requests\NominalAccounts\Beneficiaries;
|
|
|
|
use Apoloz\AlfaBank\Data\NominalAccounts\Beneficiaries\BeneficiaryTransactionCollectionData;
|
|
use Saloon\Enums\Method;
|
|
use Saloon\Http\Request;
|
|
use Saloon\Http\Response;
|
|
|
|
class GetBeneficiaryTransactionsRequest extends Request
|
|
{
|
|
protected Method $method = Method::GET;
|
|
|
|
public function __construct(
|
|
protected string $beneficiaryId,
|
|
protected string $dateFrom,
|
|
protected string $dateTo,
|
|
protected ?int $limit = 100,
|
|
protected ?int $offset = 0
|
|
) {}
|
|
|
|
public function resolveEndpoint(): string
|
|
{
|
|
return "/api/na/jp/v1/beneficiaries/{$this->beneficiaryId}/transactions";
|
|
}
|
|
|
|
protected function defaultQuery(): array
|
|
{
|
|
return [
|
|
'dateFrom' => $this->dateFrom,
|
|
'dateTo' => $this->dateTo,
|
|
'limit' => $this->limit,
|
|
'offset' => $this->offset,
|
|
];
|
|
}
|
|
|
|
public function createDtoFromResponse(Response $response): BeneficiaryTransactionCollectionData
|
|
{
|
|
return BeneficiaryTransactionCollectionData::from($response->json());
|
|
}
|
|
}
|