first commit
This commit is contained in:
48
src/Sbp/Requests/CashLink/RegCashQrRequest.php
Normal file
48
src/Sbp/Requests/CashLink/RegCashQrRequest.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Gemini\AlfaBank\Sbp\Requests\CashLink;
|
||||
|
||||
use Gemini\AlfaBank\Sbp\Data\CashLink\RegCashQrRequestData;
|
||||
use Gemini\AlfaBank\Sbp\Data\CashLink\RegCashQrResponseData;
|
||||
use Saloon\Contracts\Body\HasBody;
|
||||
use Saloon\Enums\Method;
|
||||
use Saloon\Http\Request;
|
||||
use Saloon\Http\Response;
|
||||
use Saloon\Traits\Body\HasJsonBody;
|
||||
|
||||
class RegCashQrRequest extends Request implements HasBody
|
||||
{
|
||||
use HasJsonBody;
|
||||
|
||||
protected Method $method = Method::POST;
|
||||
|
||||
public function __construct(
|
||||
protected RegCashQrRequestData $data
|
||||
) {}
|
||||
|
||||
public function resolveEndpoint(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
protected function defaultBody(): array
|
||||
{
|
||||
$body = [
|
||||
'command' => 'RegCashQRc',
|
||||
'TermNo' => $this->data->TermNo,
|
||||
];
|
||||
|
||||
if ($this->data->mediaType !== null) $body['mediaType'] = $this->data->mediaType;
|
||||
if ($this->data->width !== null) $body['width'] = $this->data->width;
|
||||
if ($this->data->height !== null) $body['height'] = $this->data->height;
|
||||
if ($this->data->redirectUrl !== null) $body['redirectUrl'] = $this->data->redirectUrl;
|
||||
if ($this->data->qrcId !== null) $body['qrcId'] = $this->data->qrcId;
|
||||
|
||||
return $body;
|
||||
}
|
||||
|
||||
public function createDtoFromResponse(Response $response): RegCashQrResponseData
|
||||
{
|
||||
return RegCashQrResponseData::from($response->json());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user