fix(formating)

This commit is contained in:
Anatoliy Poloz
2026-01-28 03:36:26 +03:00
parent 1723177949
commit b15d29f8e9
313 changed files with 1863 additions and 1533 deletions

View File

@@ -18,6 +18,7 @@ use Saloon\Enums\Method;
use Saloon\Http\Request;
use Saloon\Http\Response;
use Saloon\Traits\Body\HasJsonBody;
// </SECTION>
// <SECTION name="class_definition" intent="Define the request to activate a CashLink QR Code.">
@@ -45,6 +46,14 @@ class ActivateCashQrRequest extends Request implements HasBody
}
// </SECTION>
// <SECTION name="response_caster" intent="Return the raw JSON response as an array.">
// <BELIEF_STATE "For this specific request, the response is currently returned as a raw array. A dedicated DTO could be created if a structured object is required.">
public function createDtoFromResponse(Response $response): array
{
return $response->json();
}
// </SECTION>
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
// <BELIEF_STATE "The `command` field specifies the operation to the SBP API. Fields from the DTO are mapped, including conditional parameters for order number, payment purpose, QR TTL, and notification URLs.">
protected function defaultBody(): array
@@ -57,10 +66,18 @@ class ActivateCashQrRequest extends Request implements HasBody
'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->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];
}
@@ -68,12 +85,4 @@ class ActivateCashQrRequest extends Request implements HasBody
return $body;
}
// </SECTION>
// <SECTION name="response_caster" intent="Return the raw JSON response as an array.">
// <BELIEF_STATE "For this specific request, the response is currently returned as a raw array. A dedicated DTO could be created if a structured object is required.">
public function createDtoFromResponse(Response $response): array
{
return $response->json();
}
// </SECTION>
}

View File

@@ -51,6 +51,14 @@ class ChangeAccountForCashQrRequest extends Request implements HasBody
}
// </SECTION>
// <SECTION name="response_caster" intent="Return the raw JSON response as an array.">
// <BELIEF_STATE "For this specific request, the response is currently returned as a raw array. A dedicated DTO could be created if a structured object is required.">
public function createDtoFromResponse(\Saloon\Http\Response $response): array
{
return $response->json();
}
// </SECTION>
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
// <BELIEF_STATE "The `command` field specifies the operation to the SBP API. Fields are conditionally added based on constructor parameters, ensuring the payload precisely matches the API specification.">
protected function defaultBody(): array
@@ -62,19 +70,17 @@ class ChangeAccountForCashQrRequest extends Request implements HasBody
'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;
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;
}
// </SECTION>
// <SECTION name="response_caster" intent="Return the raw JSON response as an array.">
// <BELIEF_STATE "For this specific request, the response is currently returned as a raw array. A dedicated DTO could be created if a structured object is required.">
public function createDtoFromResponse(\Saloon\Http\Response $response): array
{
return $response->json();
}
// </SECTION>
}

View File

@@ -47,6 +47,14 @@ class ChangeTermNoForCashQrRequest extends Request implements HasBody
}
// </SECTION>
// <SECTION name="response_caster" intent="Return the raw JSON response as an array.">
// <BELIEF_STATE "For this specific request, the response is currently returned as a raw array. A dedicated DTO could be created if a structured object is required.">
public function createDtoFromResponse(\Saloon\Http\Response $response): array
{
return $response->json();
}
// </SECTION>
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
// <BELIEF_STATE "The `command` field specifies the operation to the SBP API. The `TermNo` and `qrcId` are included in the body to identify the target.">
protected function defaultBody(): array
@@ -58,12 +66,4 @@ class ChangeTermNoForCashQrRequest extends Request implements HasBody
];
}
// </SECTION>
// <SECTION name="response_caster" intent="Return the raw JSON response as an array.">
// <BELIEF_STATE "For this specific request, the response is currently returned as a raw array. A dedicated DTO could be created if a structured object is required.">
public function createDtoFromResponse(\Saloon\Http\Response $response): array
{
return $response->json();
}
// </SECTION>
}

View File

@@ -47,6 +47,14 @@ class DeleteCashQrRequest extends Request implements HasBody
}
// </SECTION>
// <SECTION name="response_caster" intent="Return the raw JSON response as an array.">
// <BELIEF_STATE "For this specific request, the response is currently returned as a raw array. A dedicated DTO could be created if a structured object is required.">
public function createDtoFromResponse(\Saloon\Http\Response $response): array
{
return $response->json();
}
// </SECTION>
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
// <BELIEF_STATE "The `command` field specifies the operation to the SBP API. The `TermNo` and `qrcId` are included in the body to identify the target.">
protected function defaultBody(): array
@@ -58,12 +66,4 @@ class DeleteCashQrRequest extends Request implements HasBody
];
}
// </SECTION>
// <SECTION name="response_caster" intent="Return the raw JSON response as an array.">
// <BELIEF_STATE "For this specific request, the response is currently returned as a raw array. A dedicated DTO could be created if a structured object is required.">
public function createDtoFromResponse(\Saloon\Http\Response $response): array
{
return $response->json();
}
// </SECTION>
}

View File

@@ -49,6 +49,14 @@ class GetCashQrHistoryRequest extends Request implements HasBody
}
// </SECTION>
// <SECTION name="response_caster" intent="Return the raw JSON response as an array.">
// <BELIEF_STATE "For this specific request, the response is currently returned as a raw array. A dedicated DTO could be created if a structured object is required.">
public function createDtoFromResponse(\Saloon\Http\Response $response): array
{
return $response->json();
}
// </SECTION>
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
// <BELIEF_STATE "The `command` field specifies the operation to the SBP API. All constructor properties are directly mapped to the request body to identify the QR Code and the date range.">
protected function defaultBody(): array
@@ -62,12 +70,4 @@ class GetCashQrHistoryRequest extends Request implements HasBody
];
}
// </SECTION>
// <SECTION name="response_caster" intent="Return the raw JSON response as an array.">
// <BELIEF_STATE "For this specific request, the response is currently returned as a raw array. A dedicated DTO could be created if a structured object is required.">
public function createDtoFromResponse(\Saloon\Http\Response $response): array
{
return $response->json();
}
// </SECTION>
}

View File

@@ -47,6 +47,14 @@ class GetCashQrStatusRequest extends Request implements HasBody
}
// </SECTION>
// <SECTION name="response_caster" intent="Return the raw JSON response as an array.">
// <BELIEF_STATE "For this specific request, the response is currently returned as a raw array. A dedicated DTO could be created if a structured object is required.">
public function createDtoFromResponse(\Saloon\Http\Response $response): array
{
return $response->json();
}
// </SECTION>
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
// <BELIEF_STATE "The `command` field specifies the operation to the SBP API. The `TermNo` and `qrcId` identify the target.">
protected function defaultBody(): array
@@ -58,12 +66,4 @@ class GetCashQrStatusRequest extends Request implements HasBody
];
}
// </SECTION>
// <SECTION name="response_caster" intent="Return the raw JSON response as an array.">
// <BELIEF_STATE "For this specific request, the response is currently returned as a raw array. A dedicated DTO could be created if a structured object is required.">
public function createDtoFromResponse(\Saloon\Http\Response $response): array
{
return $response->json();
}
// </SECTION>
}

View File

@@ -19,6 +19,7 @@ use Saloon\Enums\Method;
use Saloon\Http\Request;
use Saloon\Http\Response;
use Saloon\Traits\Body\HasJsonBody;
// </SECTION>
// <SECTION name="class_definition" intent="Define the request to register a CashLink QR Code.">
@@ -46,6 +47,14 @@ class RegCashQrRequest extends Request implements HasBody
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `RegCashQrResponseData` DTO provides a type-safe and structured object for the result of the QR Code registration.">
public function createDtoFromResponse(Response $response): RegCashQrResponseData
{
return RegCashQrResponseData::from($response->json());
}
// </SECTION>
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
// <BELIEF_STATE "The `command` field specifies the operation to the SBP API. Fields from the DTO are mapped, including conditional parameters for media type, dimensions, redirect URL, and QR Code ID.">
protected function defaultBody(): array
@@ -55,21 +64,23 @@ class RegCashQrRequest extends Request implements HasBody
'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;
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;
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `RegCashQrResponseData` DTO provides a type-safe and structured object for the result of the QR Code registration.">
public function createDtoFromResponse(Response $response): RegCashQrResponseData
{
return RegCashQrResponseData::from($response->json());
}
// </SECTION>
}

View File

@@ -19,6 +19,7 @@ use Saloon\Enums\Method;
use Saloon\Http\Request;
use Saloon\Http\Response;
use Saloon\Traits\Body\HasJsonBody;
// </SECTION>
// <SECTION name="class_definition" intent="Define the request to change the account for a CashLink Uni QR Code.">
@@ -46,6 +47,14 @@ class ChangeAccForCashUniQrRequest extends Request implements HasBody
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `ChangeAccForCashUniQrResponseData` DTO provides a type-safe and structured object for the result of the account change operation.">
public function createDtoFromResponse(Response $response): ChangeAccForCashUniQrResponseData
{
return ChangeAccForCashUniQrResponseData::from($response->json());
}
// </SECTION>
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
// <BELIEF_STATE "The `command` field specifies the operation to the SBP API. Fields from the DTO are mapped, including conditional parameters for the new account, merchant, redirect URL, etc.">
protected function defaultBody(): array
@@ -55,25 +64,35 @@ class ChangeAccForCashUniQrRequest extends Request implements HasBody
'TermNo' => $this->data->TermNo,
];
if ($this->data->messageID !== null) $body['messageID'] = $this->data->messageID;
if ($this->data->qrcId !== null) $body['qrcId'] = $this->data->qrcId;
if ($this->data->account !== null) $body['account'] = $this->data->account;
if ($this->data->accountDR !== null) $body['accountDR'] = $this->data->accountDR;
if ($this->data->NewTermNo !== null) $body['NewTermNo'] = $this->data->NewTermNo;
if ($this->data->NewMerchantId !== null) $body['NewMerchantId'] = $this->data->NewMerchantId;
if ($this->data->redirectUrl !== null) $body['redirectUrl'] = $this->data->redirectUrl;
if ($this->data->paymentPageUrl !== null) $body['paymentPageUrl'] = $this->data->paymentPageUrl;
if ($this->data->fraudScore !== null) $body['fraudScore'] = $this->data->fraudScore;
if ($this->data->messageID !== null) {
$body['messageID'] = $this->data->messageID;
}
if ($this->data->qrcId !== null) {
$body['qrcId'] = $this->data->qrcId;
}
if ($this->data->account !== null) {
$body['account'] = $this->data->account;
}
if ($this->data->accountDR !== null) {
$body['accountDR'] = $this->data->accountDR;
}
if ($this->data->NewTermNo !== null) {
$body['NewTermNo'] = $this->data->NewTermNo;
}
if ($this->data->NewMerchantId !== null) {
$body['NewMerchantId'] = $this->data->NewMerchantId;
}
if ($this->data->redirectUrl !== null) {
$body['redirectUrl'] = $this->data->redirectUrl;
}
if ($this->data->paymentPageUrl !== null) {
$body['paymentPageUrl'] = $this->data->paymentPageUrl;
}
if ($this->data->fraudScore !== null) {
$body['fraudScore'] = $this->data->fraudScore;
}
return $body;
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `ChangeAccForCashUniQrResponseData` DTO provides a type-safe and structured object for the result of the account change operation.">
public function createDtoFromResponse(Response $response): ChangeAccForCashUniQrResponseData
{
return ChangeAccForCashUniQrResponseData::from($response->json());
}
// </SECTION>
}

View File

@@ -19,6 +19,7 @@ use Saloon\Enums\Method;
use Saloon\Http\Request;
use Saloon\Http\Response;
use Saloon\Traits\Body\HasJsonBody;
// </SECTION>
// <SECTION name="class_definition" intent="Define the request to create a CashLink Uni QR Code.">
@@ -46,6 +47,14 @@ class CreateCashUniQrRequest extends Request implements HasBody
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `CreateCashUniQrResponseData` DTO provides a type-safe and structured object for the result of the QR Code creation.">
public function createDtoFromResponse(Response $response): CreateCashUniQrResponseData
{
return CreateCashUniQrResponseData::from($response->json());
}
// </SECTION>
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
// <BELIEF_STATE "The `command` field specifies the operation to the SBP API. Fields from the DTO are mapped, including conditional and nested `queryData` for notification URLs.">
protected function defaultBody(): array
@@ -55,13 +64,27 @@ class CreateCashUniQrRequest extends Request implements HasBody
'TermNo' => $this->data->TermNo,
];
if ($this->data->messageID !== null) $body['messageID'] = $this->data->messageID;
if ($this->data->redirectUrl !== null) $body['redirectUrl'] = $this->data->redirectUrl;
if ($this->data->paymentPageUrl !== null) $body['paymentPageUrl'] = $this->data->paymentPageUrl;
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->qrcId !== null) $body['qrcId'] = $this->data->qrcId;
if ($this->data->messageID !== null) {
$body['messageID'] = $this->data->messageID;
}
if ($this->data->redirectUrl !== null) {
$body['redirectUrl'] = $this->data->redirectUrl;
}
if ($this->data->paymentPageUrl !== null) {
$body['paymentPageUrl'] = $this->data->paymentPageUrl;
}
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->qrcId !== null) {
$body['qrcId'] = $this->data->qrcId;
}
if ($this->data->notificationUrl !== null) {
$body['queryData'] = ['notificationUrl' => $this->data->notificationUrl];
@@ -70,12 +93,4 @@ class CreateCashUniQrRequest extends Request implements HasBody
return $body;
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `CreateCashUniQrResponseData` DTO provides a type-safe and structured object for the result of the QR Code creation.">
public function createDtoFromResponse(Response $response): CreateCashUniQrResponseData
{
return CreateCashUniQrResponseData::from($response->json());
}
// </SECTION>
}

View File

@@ -19,6 +19,7 @@ use Saloon\Enums\Method;
use Saloon\Http\Request;
use Saloon\Http\Response;
use Saloon\Traits\Body\HasJsonBody;
// </SECTION>
// <SECTION name="class_definition" intent="Define the request to get the status of a CashLink Uni QR Code.">
@@ -46,6 +47,14 @@ class GetCashUniQrStatusRequest extends Request implements HasBody
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `GetCashUniQrStatusResponseData` DTO provides a type-safe and structured object for the status of the CashLink Uni QR Code.">
public function createDtoFromResponse(Response $response): GetCashUniQrStatusResponseData
{
return GetCashUniQrStatusResponseData::from($response->json());
}
// </SECTION>
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
// <BELIEF_STATE "The `command` field specifies the operation to the SBP API. The `TermNo`, `uniQrId`, and `paramsId` identify the target. Optional fields like `messageID` and `payrrn` provide additional context.">
protected function defaultBody(): array
@@ -57,18 +66,14 @@ class GetCashUniQrStatusRequest extends Request implements HasBody
'paramsId' => $this->data->paramsId,
];
if ($this->data->messageID !== null) $body['messageID'] = $this->data->messageID;
if ($this->data->payrrn !== null) $body['payrrn'] = $this->data->payrrn;
if ($this->data->messageID !== null) {
$body['messageID'] = $this->data->messageID;
}
if ($this->data->payrrn !== null) {
$body['payrrn'] = $this->data->payrrn;
}
return $body;
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `GetCashUniQrStatusResponseData` DTO provides a type-safe and structured object for the status of the CashLink Uni QR Code.">
public function createDtoFromResponse(Response $response): GetCashUniQrStatusResponseData
{
return GetCashUniQrStatusResponseData::from($response->json());
}
// </SECTION>
}

View File

@@ -27,6 +27,11 @@ class CreateUniQrRequest extends Request implements HasBody
return '';
}
public function createDtoFromResponse(Response $response): UniQrResponseData
{
return UniQrResponseData::from($response->json());
}
protected function defaultBody(): array
{
$body = [
@@ -35,31 +40,52 @@ class CreateUniQrRequest extends Request implements HasBody
'uniQrType' => $this->data->uniQrType,
];
if ($this->data->amount !== null) $body['amount'] = $this->data->amount;
if ($this->data->paymentPurpose !== null) $body['paymentPurpose'] = $this->data->paymentPurpose;
if ($this->data->redirectUrl !== null) $body['redirectUrl'] = $this->data->redirectUrl;
if ($this->data->paymentPageUrl !== null) $body['paymentPageUrl'] = $this->data->paymentPageUrl;
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->qrTtl !== null) $body['qrTtl'] = $this->data->qrTtl;
if ($this->data->messageID !== null) $body['messageID'] = $this->data->messageID;
if ($this->data->amount !== null) {
$body['amount'] = $this->data->amount;
}
if ($this->data->paymentPurpose !== null) {
$body['paymentPurpose'] = $this->data->paymentPurpose;
}
if ($this->data->redirectUrl !== null) {
$body['redirectUrl'] = $this->data->redirectUrl;
}
if ($this->data->paymentPageUrl !== null) {
$body['paymentPageUrl'] = $this->data->paymentPageUrl;
}
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->qrTtl !== null) {
$body['qrTtl'] = $this->data->qrTtl;
}
if ($this->data->messageID !== null) {
$body['messageID'] = $this->data->messageID;
}
$queryData = [];
if ($this->data->notificationUrl !== null) $queryData['notificationUrl'] = $this->data->notificationUrl;
if ($this->data->SenderFIO !== null) $queryData['SenderFIO'] = $this->data->SenderFIO;
if ($this->data->SenderID !== null) $queryData['SenderID'] = $this->data->SenderID;
if ($this->data->SenderBankBIC !== null) $queryData['SenderBankBIC'] = $this->data->SenderBankBIC;
if ($this->data->notificationUrl !== null) {
$queryData['notificationUrl'] = $this->data->notificationUrl;
}
if ($this->data->SenderFIO !== null) {
$queryData['SenderFIO'] = $this->data->SenderFIO;
}
if ($this->data->SenderID !== null) {
$queryData['SenderID'] = $this->data->SenderID;
}
if ($this->data->SenderBankBIC !== null) {
$queryData['SenderBankBIC'] = $this->data->SenderBankBIC;
}
if (!empty($queryData)) {
if (! empty($queryData)) {
$body['queryData'] = $queryData;
}
return $body;
}
public function createDtoFromResponse(Response $response): UniQrResponseData
{
return UniQrResponseData::from($response->json());
}
}
}

View File

@@ -47,6 +47,14 @@ class GetUniQrStatusRequest extends Request implements HasBody
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `GetUniQrStatusResponseData` DTO provides a type-safe and structured object for the status of Universal QR Codes.">
public function createDtoFromResponse(\Saloon\Http\Response $response): \Apoloz\AlfaBank\Sbp\Data\DigitalRuble\GetUniQrStatusResponseData
{
return \Apoloz\AlfaBank\Sbp\Data\DigitalRuble\GetUniQrStatusResponseData::from($response->json());
}
// </SECTION>
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
// <BELIEF_STATE "The `command` field specifies the operation to the SBP API. The `TermNo` and `uniQrIds` are included in the body to identify the targets.">
protected function defaultBody(): array
@@ -58,12 +66,4 @@ class GetUniQrStatusRequest extends Request implements HasBody
];
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `GetUniQrStatusResponseData` DTO provides a type-safe and structured object for the status of Universal QR Codes.">
public function createDtoFromResponse(\Saloon\Http\Response $response): \Apoloz\AlfaBank\Sbp\Data\DigitalRuble\GetUniQrStatusResponseData
{
return \Apoloz\AlfaBank\Sbp\Data\DigitalRuble\GetUniQrStatusResponseData::from($response->json());
}
// </SECTION>
}

View File

@@ -15,6 +15,7 @@ namespace Apoloz\AlfaBank\Sbp\Requests\DigitalRuble\Notifications;
// <BELIEF_STATE "This utility uses the `PaymentDrNotificationData` DTO to structure the incoming data. The Laravel `Request` class is typically used for obtaining raw input in a web context.">
use Apoloz\AlfaBank\Sbp\Data\DigitalRuble\Notifications\PaymentDrNotificationData;
use Illuminate\Http\Request; // Assuming this is used to get the raw incoming data, not directly as a Saloon Request.
// </SECTION>
// <SECTION name="class_definition" intent="Define a utility class for parsing Digital Ruble payment notifications.">

View File

@@ -21,6 +21,7 @@ use Saloon\Enums\Method;
use Saloon\Http\Request;
use Saloon\Http\Response;
use Saloon\Traits\Body\HasStringBody;
// </SECTION>
// <SECTION name="class_definition" intent="Define a class that encapsulates all information for the 'Get QR Code' API call.">
@@ -49,6 +50,14 @@ class GetQrCodeRequest extends Request implements HasBody
}
// </SECTION>
// <SECTION name="response_dto_caster" intent="Transform the raw API JSON response into a structured DTO.">
// <BELIEF_STATE "Automatically casting the JSON response to a `QrCodeResponseData` DTO provides a superior, type-safe developer experience. It abstracts away the raw response, allowing the user to interact with a clean, predictable object with autocompletion and static analysis benefits.">
public function createDtoFromResponse(Response $response): QrCodeResponseData
{
return QrCodeResponseData::from($response->json());
}
// </SECTION>
// <SECTION name="request_body_builder" intent="Prepare the request payload for transmission.">
// <BELIEF_STATE "This method builds the request body by adding the required 'command' field and merging the DTO data. The SBP API requires the 'command' field to identify the operation type. The 'GetQRCd' command is used for both static and dynamic QR code generation.">
protected function defaultBody(): string
@@ -57,15 +66,8 @@ class GetQrCodeRequest extends Request implements HasBody
['command' => 'GetQRCd'],
$this->data->toArray()
);
return CmsSigner::canonicalize($bodyArray);
}
// </SECTION>
// <SECTION name="response_dto_caster" intent="Transform the raw API JSON response into a structured DTO.">
// <BELIEF_STATE "Automatically casting the JSON response to a `QrCodeResponseData` DTO provides a superior, type-safe developer experience. It abstracts away the raw response, allowing the user to interact with a clean, predictable object with autocompletion and static analysis benefits.">
public function createDtoFromResponse(Response $response): QrCodeResponseData
{
return QrCodeResponseData::from($response->json());
}
// </SECTION>
}
}

View File

@@ -47,6 +47,14 @@ class BlockQrRequest extends Request implements HasBody
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `SbpManagementResponseData` DTO provides a structured object for the result of the block operation.">
public function createDtoFromResponse(\Saloon\Http\Response $response): \Apoloz\AlfaBank\Sbp\Data\Management\SbpManagementResponseData
{
return \Apoloz\AlfaBank\Sbp\Data\Management\SbpManagementResponseData::from($response->json());
}
// </SECTION>
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
// <BELIEF_STATE "The `command` field specifies the operation to the SBP API. Using the DTO's `toArray` method ensures the payload is correctly structured.">
protected function defaultBody(): array
@@ -57,12 +65,4 @@ class BlockQrRequest extends Request implements HasBody
);
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `SbpManagementResponseData` DTO provides a structured object for the result of the block operation.">
public function createDtoFromResponse(\Saloon\Http\Response $response): \Apoloz\AlfaBank\Sbp\Data\Management\SbpManagementResponseData
{
return \Apoloz\AlfaBank\Sbp\Data\Management\SbpManagementResponseData::from($response->json());
}
// </SECTION>
}

View File

@@ -46,6 +46,14 @@ class GetBlockedQrListRequest extends Request implements HasBody
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `GetBlockedQrListResponseData` DTO provides a type-safe object for the list of blocked QR Codes.">
public function createDtoFromResponse(\Saloon\Http\Response $response): \Apoloz\AlfaBank\Sbp\Data\Management\GetBlockedQrListResponseData
{
return \Apoloz\AlfaBank\Sbp\Data\Management\GetBlockedQrListResponseData::from($response->json());
}
// </SECTION>
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
// <BELIEF_STATE "The `command` field specifies the operation to the SBP API. The `TermNo` is included in the body to identify the terminal.">
protected function defaultBody(): array
@@ -56,12 +64,4 @@ class GetBlockedQrListRequest extends Request implements HasBody
];
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `GetBlockedQrListResponseData` DTO provides a type-safe object for the list of blocked QR Codes.">
public function createDtoFromResponse(\Saloon\Http\Response $response): \Apoloz\AlfaBank\Sbp\Data\Management\GetBlockedQrListResponseData
{
return \Apoloz\AlfaBank\Sbp\Data\Management\GetBlockedQrListResponseData::from($response->json());
}
// </SECTION>
}

View File

@@ -47,6 +47,14 @@ class UnblockQrRequest extends Request implements HasBody
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `SbpManagementResponseData` DTO provides a structured object for the result of the unblock operation.">
public function createDtoFromResponse(\Saloon\Http\Response $response): \Apoloz\AlfaBank\Sbp\Data\Management\SbpManagementResponseData
{
return \Apoloz\AlfaBank\Sbp\Data\Management\SbpManagementResponseData::from($response->json());
}
// </SECTION>
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
// <BELIEF_STATE "The `command` field specifies the operation to the SBP API. Using the DTO's `toArray` method ensures the payload is correctly structured.">
protected function defaultBody(): array
@@ -57,12 +65,4 @@ class UnblockQrRequest extends Request implements HasBody
);
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `SbpManagementResponseData` DTO provides a structured object for the result of the unblock operation.">
public function createDtoFromResponse(\Saloon\Http\Response $response): \Apoloz\AlfaBank\Sbp\Data\Management\SbpManagementResponseData
{
return \Apoloz\AlfaBank\Sbp\Data\Management\SbpManagementResponseData::from($response->json());
}
// </SECTION>
}

View File

@@ -18,6 +18,7 @@ use Saloon\Enums\Method;
use Saloon\Http\Request;
use Saloon\Http\Response;
use Saloon\Traits\Body\HasJsonBody;
// </SECTION>
// <SECTION name="class_definition" intent="Define the request to get the SBP bank list.">
@@ -46,6 +47,14 @@ class GetBankListRequest extends Request implements HasBody
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `GetBankListResponseData` DTO provides a type-safe and structured object for the list of SBP banks.">
public function createDtoFromResponse(Response $response): GetBankListResponseData
{
return GetBankListResponseData::from($response->json());
}
// </SECTION>
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
// <BELIEF_STATE "The `command` field specifies the operation to the SBP API. Optional fields are conditionally added to the body.">
protected function defaultBody(): array
@@ -54,18 +63,14 @@ class GetBankListRequest extends Request implements HasBody
'command' => 'GetBankList',
];
if ($this->messageID !== null) $body['messageID'] = $this->messageID;
if ($this->BankMemberIdFilter !== null) $body['BankMemberIdFilter'] = $this->BankMemberIdFilter;
if ($this->messageID !== null) {
$body['messageID'] = $this->messageID;
}
if ($this->BankMemberIdFilter !== null) {
$body['BankMemberIdFilter'] = $this->BankMemberIdFilter;
}
return $body;
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `GetBankListResponseData` DTO provides a type-safe and structured object for the list of SBP banks.">
public function createDtoFromResponse(Response $response): GetBankListResponseData
{
return GetBankListResponseData::from($response->json());
}
// </SECTION>
}

View File

@@ -19,6 +19,7 @@ use Saloon\Enums\Method;
use Saloon\Http\Request;
use Saloon\Http\Response;
use Saloon\Traits\Body\HasJsonBody;
// </SECTION>
// <SECTION name="class_definition" intent="Define the request to get detailed QR Code reversal data.">
@@ -46,6 +47,14 @@ class GetQrcReversalDataRequest extends Request implements HasBody
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `GetQrcReversalDataResponseData` DTO provides a type-safe and structured object for the detailed reversal data.">
public function createDtoFromResponse(Response $response): GetQrcReversalDataResponseData
{
return GetQrcReversalDataResponseData::from($response->json());
}
// </SECTION>
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
// <BELIEF_STATE "The `command` field specifies the operation to the SBP API. Other fields from the DTO are conditionally added, ensuring the payload precisely matches the API specification.">
protected function defaultBody(): array
@@ -56,12 +65,4 @@ class GetQrcReversalDataRequest extends Request implements HasBody
);
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `GetQrcReversalDataResponseData` DTO provides a type-safe and structured object for the detailed reversal data.">
public function createDtoFromResponse(Response $response): GetQrcReversalDataResponseData
{
return GetQrcReversalDataResponseData::from($response->json());
}
// </SECTION>
}

View File

@@ -27,6 +27,11 @@ class GetQrcReversalHistoryRequest extends Request implements HasBody
return '';
}
public function createDtoFromResponse(Response $response): ReversalHistoryResponseData
{
return ReversalHistoryResponseData::from($response->json());
}
protected function defaultBody(): array
{
return [
@@ -35,9 +40,4 @@ class GetQrcReversalHistoryRequest extends Request implements HasBody
'payrrn' => $this->payrrn,
];
}
public function createDtoFromResponse(Response $response): ReversalHistoryResponseData
{
return ReversalHistoryResponseData::from($response->json());
}
}

View File

@@ -19,6 +19,7 @@ use Saloon\Enums\Method;
use Saloon\Http\Request;
use Saloon\Http\Response;
use Saloon\Traits\Body\HasJsonBody;
// </SECTION>
// <SECTION name="class_definition" intent="Define the request to get the status of a QR Code reversal.">
@@ -46,6 +47,14 @@ class GetQrcReversalStatusRequest extends Request implements HasBody
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `GetQrcReversalStatusResponseData` DTO provides a type-safe and structured object for the status of the reversal.">
public function createDtoFromResponse(Response $response): GetQrcReversalStatusResponseData
{
return GetQrcReversalStatusResponseData::from($response->json());
}
// </SECTION>
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
// <BELIEF_STATE "The `command` field specifies the operation to the SBP API. Other fields from the DTO are conditionally added, ensuring the payload precisely matches the API specification.">
protected function defaultBody(): array
@@ -56,12 +65,4 @@ class GetQrcReversalStatusRequest extends Request implements HasBody
);
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `GetQrcReversalStatusResponseData` DTO provides a type-safe and structured object for the status of the reversal.">
public function createDtoFromResponse(Response $response): GetQrcReversalStatusResponseData
{
return GetQrcReversalStatusResponseData::from($response->json());
}
// </SECTION>
}

View File

@@ -19,6 +19,7 @@ use Saloon\Enums\Method;
use Saloon\Http\Request;
use Saloon\Http\Response;
use Saloon\Traits\Body\HasJsonBody;
// </SECTION>
// <SECTION name="class_definition" intent="Define the request to initiate a QR Code reversal.">
@@ -46,6 +47,14 @@ class QrcReversalRequest extends Request implements HasBody
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `QrcReversalResponseData` DTO provides a type-safe and structured object for the result of the reversal.">
public function createDtoFromResponse(Response $response): QrcReversalResponseData
{
return QrcReversalResponseData::from($response->json());
}
// </SECTION>
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
// <BELIEF_STATE "The `command` field specifies the operation to the SBP API. Other fields from the DTO are conditionally added, ensuring the payload precisely matches the API specification.">
protected function defaultBody(): array
@@ -56,12 +65,4 @@ class QrcReversalRequest extends Request implements HasBody
);
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `QrcReversalResponseData` DTO provides a type-safe and structured object for the result of the reversal.">
public function createDtoFromResponse(Response $response): QrcReversalResponseData
{
return QrcReversalResponseData::from($response->json());
}
// </SECTION>
}

View File

@@ -19,6 +19,7 @@ use Saloon\Enums\Method;
use Saloon\Http\Request;
use Saloon\Http\Response;
use Saloon\Traits\Body\HasJsonBody;
// </SECTION>
// <SECTION name="class_definition" intent="Define the request to get the status of a QR Code.">
@@ -46,6 +47,14 @@ class GetQrcStatusRequest extends Request implements HasBody
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `GetQrcStatusResponseData` DTO provides a type-safe and structured object for the status of the QR Code.">
public function createDtoFromResponse(Response $response): GetQrcStatusResponseData
{
return GetQrcStatusResponseData::from($response->json());
}
// </SECTION>
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
// <BELIEF_STATE "The `command` field specifies the operation to the SBP API. The `TermNo` is mandatory, and `qrcId`, `payrrn`, and `messageID` are optional filters to pinpoint the transaction.">
protected function defaultBody(): array
@@ -56,12 +65,4 @@ class GetQrcStatusRequest extends Request implements HasBody
);
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `GetQrcStatusResponseData` DTO provides a type-safe and structured object for the status of the QR Code.">
public function createDtoFromResponse(Response $response): GetQrcStatusResponseData
{
return GetQrcStatusResponseData::from($response->json());
}
// </SECTION>
}

View File

@@ -48,6 +48,14 @@ class GetQrSubStatusRequest extends Request implements HasBody
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `GetQrSubStatusResponseData` DTO provides a structured object for the status of the subscription.">
public function createDtoFromResponse(\Saloon\Http\Response $response): \Apoloz\AlfaBank\Sbp\Data\Subscription\GetQrSubStatusResponseData
{
return \Apoloz\AlfaBank\Sbp\Data\Subscription\GetQrSubStatusResponseData::from($response->json());
}
// </SECTION>
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
// <BELIEF_STATE "The `command` field specifies the operation to the SBP API. Other fields are conditionally added, ensuring the payload precisely matches the API specification.">
protected function defaultBody(): array
@@ -65,12 +73,4 @@ class GetQrSubStatusRequest extends Request implements HasBody
return $body;
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `GetQrSubStatusResponseData` DTO provides a structured object for the status of the subscription.">
public function createDtoFromResponse(\Saloon\Http\Response $response): \Apoloz\AlfaBank\Sbp\Data\Subscription\GetQrSubStatusResponseData
{
return \Apoloz\AlfaBank\Sbp\Data\Subscription\GetQrSubStatusResponseData::from($response->json());
}
// </SECTION>
}

View File

@@ -17,6 +17,7 @@ use Saloon\Enums\Method;
use Saloon\Http\Request;
use Saloon\Http\Response;
use Saloon\Traits\Body\HasJsonBody;
// </SECTION>
// <SECTION name="class_definition" intent="Define the request to petition a QR Code subscription payment.">
@@ -47,6 +48,14 @@ class QrcSubPayPetitionRequest extends Request implements HasBody
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `QrcSubPayPetitionResponseData` DTO provides a structured object for the result of the payment petition.">
public function createDtoFromResponse(Response $response): \Apoloz\AlfaBank\Sbp\Data\Subscription\QrcSubPayPetitionResponseData
{
return \Apoloz\AlfaBank\Sbp\Data\Subscription\QrcSubPayPetitionResponseData::from($response->json());
}
// </SECTION>
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
// <BELIEF_STATE "The `command` field specifies the operation to the SBP API. All constructor properties are directly mapped to the request body.">
protected function defaultBody(): array
@@ -60,12 +69,4 @@ class QrcSubPayPetitionRequest extends Request implements HasBody
];
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `QrcSubPayPetitionResponseData` DTO provides a structured object for the result of the payment petition.">
public function createDtoFromResponse(Response $response): \Apoloz\AlfaBank\Sbp\Data\Subscription\QrcSubPayPetitionResponseData
{
return \Apoloz\AlfaBank\Sbp\Data\Subscription\QrcSubPayPetitionResponseData::from($response->json());
}
// </SECTION>
}

View File

@@ -18,6 +18,7 @@ use Saloon\Enums\Method;
use Saloon\Http\Request;
use Saloon\Http\Response;
use Saloon\Traits\Body\HasJsonBody;
// </SECTION>
// <SECTION name="class_definition" intent="Define the request to register a QR Code subscription.">
@@ -45,6 +46,14 @@ class RegQrSubRequest extends Request implements HasBody
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `RegQrSubResponseData` DTO provides a structured object for the result of the subscription registration.">
public function createDtoFromResponse(Response $response): \Apoloz\AlfaBank\Sbp\Data\Subscription\RegQrSubResponseData
{
return \Apoloz\AlfaBank\Sbp\Data\Subscription\RegQrSubResponseData::from($response->json());
}
// </SECTION>
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
// <BELIEF_STATE "The `command` field specifies the operation to the SBP API. Using the DTO's `toArray` method ensures the payload is correctly structured.">
protected function defaultBody(): array
@@ -55,12 +64,4 @@ class RegQrSubRequest extends Request implements HasBody
);
}
// </SECTION>
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
// <BELIEF_STATE "Casting the response to a `RegQrSubResponseData` DTO provides a structured object for the result of the subscription registration.">
public function createDtoFromResponse(Response $response): \Apoloz\AlfaBank\Sbp\Data\Subscription\RegQrSubResponseData
{
return \Apoloz\AlfaBank\Sbp\Data\Subscription\RegQrSubResponseData::from($response->json());
}
// </SECTION>
}