add Identification

This commit is contained in:
Anatoliy Poloz
2026-03-19 19:38:21 +03:00
parent b7b2a8fd61
commit 4f52a189c7

View File

@@ -0,0 +1,63 @@
<?php
declare(strict_types=1);
namespace Apoloz\AlfaBank\Requests\NominalAccounts\Identification;
use Apoloz\AlfaBank\Data\NominalAccounts\Identification\UnidentifiedTransactionData;
use Saloon\Contracts\Body\HasBody;
use Saloon\Enums\Method;
use Saloon\Http\Request;
use Saloon\Http\Response;
use Saloon\Traits\Body\HasJsonBody;
class CreateUnidentifiedTransactionRequest extends Request implements HasBody
{
use HasJsonBody;
protected Method $method = Method::POST;
public function __construct(
protected string $documentNumber,
protected string $date,
protected float $amount,
protected string $purpose,
protected string $accountNumber,
protected ?array $payer = null,
) {}
public function resolveEndpoint(): string
{
return '/api/na/jp/v1/unidentified-transactions';
}
public function createDtoFromResponse(Response $response): UnidentifiedTransactionData
{
return UnidentifiedTransactionData::from($response->json());
}
protected function defaultBody(): array
{
return array_filter([
'documentNumber' => $this->documentNumber,
'date' => $this->date,
'amount' => $this->amount,
'purpose' => $this->purpose,
'accountNumber' => $this->accountNumber,
'payer' => $this->payer ?? $this->getDefaultPayer(),
], fn ($value) => $value !== null);
}
protected function getDefaultPayer(): array
{
return [
'inn' => '221284672706',
'kpp' => '641914992',
'accountNumber' => '87149728127096890679',
'name' => 'Тестовый плательщик',
'bankAccount' => '3932755239052037086628',
'bankBik' => '108997635',
'bankName' => 'АО "Альфа-Банк"',
];
}
}