forked from apoloz/alfa-bank-sdk
first commit
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Gemini\AlfaBank\Requests\NominalAccounts\UniversalRecipients;
|
||||
|
||||
use Gemini\AlfaBank\Data\NominalAccounts\UniversalRecipients\UniversalRecipientData;
|
||||
use Saloon\Enums\Method;
|
||||
use Saloon\Http\Request;
|
||||
use Saloon\Http\Response;
|
||||
use Spatie\LaravelData\DataCollection;
|
||||
|
||||
class GetUniversalRecipientsRequest extends Request
|
||||
{
|
||||
protected Method $method = Method::GET;
|
||||
|
||||
public function __construct(
|
||||
protected string $accountNumber,
|
||||
protected string $type,
|
||||
protected ?int $limit = 100,
|
||||
protected ?int $offset = 0,
|
||||
protected ?bool $isActive = null,
|
||||
protected ?string $date = null,
|
||||
) {}
|
||||
|
||||
public function resolveEndpoint(): string
|
||||
{
|
||||
return '/api/na/jp/v1/universal-recipients';
|
||||
}
|
||||
|
||||
protected function defaultQuery(): array
|
||||
{
|
||||
return array_filter([
|
||||
'accountNumber' => $this->accountNumber,
|
||||
'type' => $this->type,
|
||||
'limit' => $this->limit,
|
||||
'offset' => $this->offset,
|
||||
'isActive' => $this->isActive,
|
||||
'date' => $this->date,
|
||||
], fn($val) => $val !== null);
|
||||
}
|
||||
|
||||
public function createDtoFromResponse(Response $response): DataCollection
|
||||
{
|
||||
return UniversalRecipientData::collect($response->json('universalRecipients'), DataCollection::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user