48 lines
1.4 KiB
PHP
48 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Apoloz\AlfaBank\Sbp\Requests\Reversal;
|
|
|
|
use Apoloz\AlfaBank\Sbp\Data\Reversal\GetQrcReversalStatusRequestData;
|
|
use Apoloz\AlfaBank\Sbp\Data\Reversal\GetQrcReversalStatusResponseData;
|
|
use Saloon\Contracts\Body\HasBody;
|
|
use Saloon\Enums\Method;
|
|
use Saloon\Http\Request;
|
|
use Saloon\Http\Response;
|
|
use Saloon\Traits\Body\HasJsonBody;
|
|
|
|
class GetQrcReversalStatusRequest extends Request implements HasBody
|
|
{
|
|
use HasJsonBody;
|
|
|
|
protected Method $method = Method::POST;
|
|
|
|
public function __construct(
|
|
protected GetQrcReversalStatusRequestData $data
|
|
) {}
|
|
|
|
public function resolveEndpoint(): string
|
|
{
|
|
return '';
|
|
}
|
|
|
|
protected function defaultBody(): array
|
|
{
|
|
$body = [
|
|
'command' => 'GetQRCreversalStatus',
|
|
'TermNo' => $this->data->TermNo,
|
|
];
|
|
|
|
if ($this->data->payrrn !== null) $body['payrrn'] = $this->data->payrrn;
|
|
if ($this->data->originalTrxId !== null) $body['originalTrxId'] = $this->data->originalTrxId;
|
|
if ($this->data->trxId !== null) $body['trxId'] = $this->data->trxId;
|
|
if ($this->data->messageID !== null) $body['messageID'] = $this->data->messageID;
|
|
|
|
return $body;
|
|
}
|
|
|
|
public function createDtoFromResponse(Response $response): GetQrcReversalStatusResponseData
|
|
{
|
|
return GetQrcReversalStatusResponseData::from($response->json());
|
|
}
|
|
}
|