first commit

This commit is contained in:
2026-01-14 16:40:33 +03:00
commit f803480f7b
184 changed files with 5573 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
<?php
namespace Gemini\AlfaBank\Sbp\Requests\Reversal;
use Gemini\AlfaBank\Sbp\Data\Reversal\QrcReversalRequestData;
use Gemini\AlfaBank\Sbp\Data\Reversal\QrcReversalResponseData;
use Saloon\Contracts\Body\HasBody;
use Saloon\Enums\Method;
use Saloon\Http\Request;
use Saloon\Http\Response;
use Saloon\Traits\Body\HasJsonBody;
class QrcReversalRequest extends Request implements HasBody
{
use HasJsonBody;
protected Method $method = Method::POST;
public function __construct(
protected QrcReversalRequestData $data
) {}
public function resolveEndpoint(): string
{
return '';
}
protected function defaultBody(): array
{
$body = [
'command' => 'QRCreversal',
'TermNo' => $this->data->TermNo,
'currency' => $this->data->currency,
];
if ($this->data->qrcId !== null) $body['qrcId'] = $this->data->qrcId;
if ($this->data->payrrn !== null) $body['payrrn'] = $this->data->payrrn;
if ($this->data->trxId !== null) $body['trxId'] = $this->data->trxId;
if ($this->data->trxDT !== null) $body['trxDT'] = $this->data->trxDT;
if ($this->data->amount !== null) $body['amount'] = $this->data->amount;
if ($this->data->messageID !== null) $body['messageID'] = $this->data->messageID;
if ($this->data->notificationUrl !== null) $body['queryData'] = ['notificationUrl' => $this->data->notificationUrl];
if ($this->data->ReturnRestAmount !== null) $body['ReturnRestAmount'] = $this->data->ReturnRestAmount;
return $body;
}
public function createDtoFromResponse(Response $response): QrcReversalResponseData
{
return QrcReversalResponseData::from($response->json());
}
}