refactor(qr)

This commit is contained in:
Anatoliy Poloz
2026-04-02 16:45:41 +03:00
parent a05a6506e8
commit 3cf15b7913
2 changed files with 41 additions and 13 deletions

View File

@@ -0,0 +1,39 @@
<?php
declare(strict_types=1);
/*
// MODULE_CONTRACT: Defines the data structure for the response when generating an SBP QR Code.
// RESPONSIBILITY: To provide a strongly-typed structure for the API's response to QR code generation requests, including status, potential error messages, and the generated QR code data (image, payload, ID).
// INPUTS: Raw array data from the SBP QR Code generation API response.
// OUTPUTS: An instantiated DTO with properties mapped from the input array.
// LINKS: Sbp/Requests/GetQrCodeRequest.php, README.md#sbp-api
*/
namespace Apoloz\AlfaBank\Sbp\Data;
// <SECTION name="module_imports" intent="Import the base Spatie\LaravelData class.">
// <BELIEF_STATE "This class extends `Spatie\LaravelData\Data` to leverage its robust data mapping and type safety, ensuring consistent and predictable handling of SBP QR Code response payloads.">
use Spatie\LaravelData\Data;
// </SECTION>
/**
*
* "queryData":
{
"notificationUrl":"https://sbp-payments",
"SenderFIO":"Иванов|Иван|Иванович",
"SenderID":"0079123456789",
"SenderBankBIC":"44525593"
}
*
* */
// <SECTION name="class_definition" intent="Define the QR Code response data structure.">
// <BELIEF_STATE "The `QrCodeResponseData` DTO encapsulates all possible fields returned by the SBP QR Code generation API. Fields are explicitly typed as nullable to accommodate variations in API responses, particularly for error scenarios where certain data might be absent.">
class GetQRCdQueryData extends Data
{
public function __construct(
public string $notificationUrl,
public string $SenderFIO,
public string $SenderID
) {}
}