forked from apoloz/alfa-bank-sdk
first commit
This commit is contained in:
52
src/Sbp/Requests/CashLink/ActivateCashQrRequest.php
Normal file
52
src/Sbp/Requests/CashLink/ActivateCashQrRequest.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace Gemini\AlfaBank\Sbp\Requests\CashLink;
|
||||
|
||||
use Gemini\AlfaBank\Sbp\Data\CashLink\ActivateCashQrRequestData;
|
||||
use Saloon\Contracts\Body\HasBody;
|
||||
use Saloon\Enums\Method;
|
||||
use Saloon\Http\Request;
|
||||
use Saloon\Http\Response;
|
||||
use Saloon\Traits\Body\HasJsonBody;
|
||||
|
||||
class ActivateCashQrRequest extends Request implements HasBody
|
||||
{
|
||||
use HasJsonBody;
|
||||
|
||||
protected Method $method = Method::POST;
|
||||
|
||||
public function __construct(
|
||||
protected ActivateCashQrRequestData $data
|
||||
) {}
|
||||
|
||||
public function resolveEndpoint(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
protected function defaultBody(): array
|
||||
{
|
||||
$body = [
|
||||
'command' => 'ActivateCashQRc',
|
||||
'TermNo' => $this->data->TermNo,
|
||||
'qrcId' => $this->data->qrcId,
|
||||
'amount' => $this->data->amount,
|
||||
'currency' => $this->data->currency,
|
||||
];
|
||||
|
||||
if ($this->data->OrderNumber !== null) $body['OrderNumber'] = $this->data->OrderNumber;
|
||||
if ($this->data->paymentPurpose !== null) $body['paymentPurpose'] = $this->data->paymentPurpose;
|
||||
if ($this->data->qrTtl !== null) $body['qrTtl'] = $this->data->qrTtl;
|
||||
if ($this->data->redirectUrl !== null) $body['redirectUrl'] = $this->data->redirectUrl;
|
||||
if ($this->data->notificationUrl !== null) {
|
||||
$body['queryData'] = ['notificationUrl' => $this->data->notificationUrl];
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
|
||||
public function createDtoFromResponse(Response $response): array
|
||||
{
|
||||
return $response->json();
|
||||
}
|
||||
}
|
||||
50
src/Sbp/Requests/CashLink/ChangeAccountForCashQrRequest.php
Normal file
50
src/Sbp/Requests/CashLink/ChangeAccountForCashQrRequest.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace Gemini\AlfaBank\Sbp\Requests\CashLink;
|
||||
|
||||
use Saloon\Contracts\Body\HasBody;
|
||||
use Saloon\Enums\Method;
|
||||
use Saloon\Http\Request;
|
||||
use Saloon\Traits\Body\HasJsonBody;
|
||||
|
||||
class ChangeAccountForCashQrRequest extends Request implements HasBody
|
||||
{
|
||||
use HasJsonBody;
|
||||
|
||||
protected Method $method = Method::POST;
|
||||
|
||||
public function __construct(
|
||||
protected string $TermNo,
|
||||
protected string $qrcId,
|
||||
protected string $account,
|
||||
protected ?string $NewTermNo = null,
|
||||
protected ?string $NewMerchantId = null,
|
||||
protected ?string $redirectUrl = null,
|
||||
) {}
|
||||
|
||||
public function resolveEndpoint(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
protected function defaultBody(): array
|
||||
{
|
||||
$body = [
|
||||
'command' => 'ChangeAccForCashQRc',
|
||||
'TermNo' => $this->TermNo,
|
||||
'qrcId' => $this->qrcId,
|
||||
'account' => $this->account,
|
||||
];
|
||||
|
||||
if ($this->NewTermNo !== null) $body['NewTermNo'] = $this->NewTermNo;
|
||||
if ($this->NewMerchantId !== null) $body['NewMerchantId'] = $this->NewMerchantId;
|
||||
if ($this->redirectUrl !== null) $body['redirectUrl'] = $this->redirectUrl;
|
||||
|
||||
return $body;
|
||||
}
|
||||
|
||||
public function createDtoFromResponse(\Saloon\Http\Response $response): array
|
||||
{
|
||||
return $response->json();
|
||||
}
|
||||
}
|
||||
39
src/Sbp/Requests/CashLink/ChangeTermNoForCashQrRequest.php
Normal file
39
src/Sbp/Requests/CashLink/ChangeTermNoForCashQrRequest.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Gemini\AlfaBank\Sbp\Requests\CashLink;
|
||||
|
||||
use Saloon\Contracts\Body\HasBody;
|
||||
use Saloon\Enums\Method;
|
||||
use Saloon\Http\Request;
|
||||
use Saloon\Traits\Body\HasJsonBody;
|
||||
|
||||
class ChangeTermNoForCashQrRequest extends Request implements HasBody
|
||||
{
|
||||
use HasJsonBody;
|
||||
|
||||
protected Method $method = Method::POST;
|
||||
|
||||
public function __construct(
|
||||
protected string $TermNo,
|
||||
protected string $qrcId
|
||||
) {}
|
||||
|
||||
public function resolveEndpoint(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
protected function defaultBody(): array
|
||||
{
|
||||
return [
|
||||
'command' => 'ChangeTermNoForCashQRc',
|
||||
'TermNo' => $this->TermNo,
|
||||
'qrcId' => $this->qrcId,
|
||||
];
|
||||
}
|
||||
|
||||
public function createDtoFromResponse(\Saloon\Http\Response $response): array
|
||||
{
|
||||
return $response->json();
|
||||
}
|
||||
}
|
||||
39
src/Sbp/Requests/CashLink/DeleteCashQrRequest.php
Normal file
39
src/Sbp/Requests/CashLink/DeleteCashQrRequest.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Gemini\AlfaBank\Sbp\Requests\CashLink;
|
||||
|
||||
use Saloon\Contracts\Body\HasBody;
|
||||
use Saloon\Enums\Method;
|
||||
use Saloon\Http\Request;
|
||||
use Saloon\Traits\Body\HasJsonBody;
|
||||
|
||||
class DeleteCashQrRequest extends Request implements HasBody
|
||||
{
|
||||
use HasJsonBody;
|
||||
|
||||
protected Method $method = Method::POST;
|
||||
|
||||
public function __construct(
|
||||
protected string $TermNo,
|
||||
protected string $qrcId
|
||||
) {}
|
||||
|
||||
public function resolveEndpoint(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
protected function defaultBody(): array
|
||||
{
|
||||
return [
|
||||
'command' => 'DelCashQRc',
|
||||
'TermNo' => $this->TermNo,
|
||||
'qrcId' => $this->qrcId,
|
||||
];
|
||||
}
|
||||
|
||||
public function createDtoFromResponse(\Saloon\Http\Response $response): array
|
||||
{
|
||||
return $response->json();
|
||||
}
|
||||
}
|
||||
43
src/Sbp/Requests/CashLink/GetCashQrHistoryRequest.php
Normal file
43
src/Sbp/Requests/CashLink/GetCashQrHistoryRequest.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Gemini\AlfaBank\Sbp\Requests\CashLink;
|
||||
|
||||
use Saloon\Contracts\Body\HasBody;
|
||||
use Saloon\Enums\Method;
|
||||
use Saloon\Http\Request;
|
||||
use Saloon\Traits\Body\HasJsonBody;
|
||||
|
||||
class GetCashQrHistoryRequest extends Request implements HasBody
|
||||
{
|
||||
use HasJsonBody;
|
||||
|
||||
protected Method $method = Method::POST;
|
||||
|
||||
public function __construct(
|
||||
protected string $TermNo,
|
||||
protected string $qrcId,
|
||||
protected string $dateFrom,
|
||||
protected string $dateTo
|
||||
) {}
|
||||
|
||||
public function resolveEndpoint(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
protected function defaultBody(): array
|
||||
{
|
||||
return [
|
||||
'command' => 'GetCashQrcId',
|
||||
'TermNo' => $this->TermNo,
|
||||
'qrcId' => $this->qrcId,
|
||||
'dateFrom' => $this->dateFrom,
|
||||
'dateTo' => $this->dateTo,
|
||||
];
|
||||
}
|
||||
|
||||
public function createDtoFromResponse(\Saloon\Http\Response $response): array
|
||||
{
|
||||
return $response->json();
|
||||
}
|
||||
}
|
||||
39
src/Sbp/Requests/CashLink/GetCashQrStatusRequest.php
Normal file
39
src/Sbp/Requests/CashLink/GetCashQrStatusRequest.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Gemini\AlfaBank\Sbp\Requests\CashLink;
|
||||
|
||||
use Saloon\Contracts\Body\HasBody;
|
||||
use Saloon\Enums\Method;
|
||||
use Saloon\Http\Request;
|
||||
use Saloon\Traits\Body\HasJsonBody;
|
||||
|
||||
class GetCashQrStatusRequest extends Request implements HasBody
|
||||
{
|
||||
use HasJsonBody;
|
||||
|
||||
protected Method $method = Method::POST;
|
||||
|
||||
public function __construct(
|
||||
protected string $TermNo,
|
||||
protected string $qrcId
|
||||
) {}
|
||||
|
||||
public function resolveEndpoint(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
protected function defaultBody(): array
|
||||
{
|
||||
return [
|
||||
'command' => 'GetCashQRCstatus',
|
||||
'TermNo' => $this->TermNo,
|
||||
'qrcId' => $this->qrcId,
|
||||
];
|
||||
}
|
||||
|
||||
public function createDtoFromResponse(\Saloon\Http\Response $response): array
|
||||
{
|
||||
return $response->json();
|
||||
}
|
||||
}
|
||||
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