refactor(core): enhance SDK structure and documentation

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
2026-01-18 21:48:25 +03:00
parent 3da69c03e1
commit d214eecebe
378 changed files with 10514 additions and 496 deletions

View File

@@ -1,11 +1,25 @@
<?php
/*
// MODULE_CONTRACT: Defines the data structure for an SBP QR Code reversal data request payload.
// RESPONSIBILITY: To hold and type-safely represent the parameters needed to query detailed information about a QR Code reversal.
// INPUTS: Terminal number (TermNo), currency, and various optional reversal identifiers.
// OUTPUTS: A structured, type-safe object for the `GetQrcReversalDataRequest` payload.
// LINKS: Sbp/Requests/Reversal/GetQrcReversalDataRequest.php
*/
namespace Apoloz\AlfaBank\Sbp\Data\Reversal;
// <SECTION name="module_imports" intent="Import the base Spatie Laravel Data class.">
// <BELIEF_STATE "Extending `Spatie\LaravelData\Data` enables automatic casting from arrays and provides DTO benefits.">
use Spatie\LaravelData\Data;
// </SECTION>
// <SECTION name="class_definition" intent="Define a DTO for SBP QR Code reversal data request.">
// <BELIEF_STATE "This DTO ensures the reversal data request payload is strictly typed and complete, supporting clear communication with the SBP API.">
class GetQrcReversalDataRequestData extends Data
{
// <SECTION name="constructor_properties" intent="Define the properties for the QR Code reversal data request.">
// <BELIEF_STATE "The constructor includes the mandatory `TermNo` and `currency`. Optional identifiers like `qrcId`, `payrrn`, `trxId`, `trxDT`, `amount`, `messageID`, and `ReturnRestAmount` provide flexibility for various reversal data queries.">
public function __construct(
public string $TermNo,
public ?string $qrcId = null,
@@ -17,4 +31,5 @@ class GetQrcReversalDataRequestData extends Data
public ?string $messageID = null,
public ?bool $ReturnRestAmount = null,
) {}
// </SECTION>
}

View File

@@ -1,11 +1,25 @@
<?php
/*
// MODULE_CONTRACT: Defines the data structure for the response of a QR Code reversal data request.
// RESPONSIBILITY: To hold and type-safely represent detailed information about an SBP QR Code reversal.
// INPUTS: Raw JSON object from the API response.
// OUTPUTS: A structured object containing detailed reversal data.
// LINKS: Sbp/Requests/Reversal/GetQrcReversalDataRequest.php
*/
namespace Apoloz\AlfaBank\Sbp\Data\Reversal;
// <SECTION name="module_imports" intent="Import the base Spatie Laravel Data class.">
// <BELIEF_STATE "Extending `Spatie\LaravelData\Data` enables automatic casting from JSON and provides DTO benefits.">
use Spatie\LaravelData\Data;
// </SECTION>
// <SECTION name="class_definition" intent="Define a DTO for detailed SBP QR Code reversal data response.">
// <BELIEF_STATE "This DTO provides a clear, type-safe contract for the detailed outcome of a reversal data query, crucial for reconciliation and error analysis.">
class GetQrcReversalDataResponseData extends Data
{
// <SECTION name="constructor_properties" intent="Define the properties of the QR Code reversal data response.">
// <BELIEF_STATE "The constructor includes mandatory error codes and messages, along with optional detailed information about the reversal such as `TermNo`, `messageID`, payer details, `payrrn`, `qrcId`, `trxDT`, `trxId`, and `restAmount`.">
public function __construct(
public int $ErrorCode,
public string $message,
@@ -21,4 +35,5 @@ class GetQrcReversalDataResponseData extends Data
public ?string $trxId = null,
public ?string $restAmount = null,
) {}
// </SECTION>
}

View File

@@ -1,11 +1,25 @@
<?php
/*
// MODULE_CONTRACT: Defines the data structure for a SBP QR Code reversal status request payload.
// RESPONSIBILITY: To hold and type-safely represent the parameters needed to query the status of a QR Code reversal.
// INPUTS: Terminal number (TermNo) and various optional reversal identifiers.
// OUTPUTS: A structured, type-safe object for the `GetQrcReversalStatusRequest` payload.
// LINKS: Sbp/Requests/Reversal/GetQrcReversalStatusRequest.php
*/
namespace Apoloz\AlfaBank\Sbp\Data\Reversal;
// <SECTION name="module_imports" intent="Import the base Spatie Laravel Data class.">
// <BELIEF_STATE "Extending `Spatie\LaravelData\Data` enables automatic casting from arrays and provides DTO benefits.">
use Spatie\LaravelData\Data;
// </SECTION>
// <SECTION name="class_definition" intent="Define a DTO for SBP QR Code reversal status request.">
// <BELIEF_STATE "This DTO ensures the reversal status request payload is strictly typed and complete, supporting clear communication with the SBP API.">
class GetQrcReversalStatusRequestData extends Data
{
// <SECTION name="constructor_properties" intent="Define the properties for the QR Code reversal status request.">
// <BELIEF_STATE "The constructor includes the mandatory `TermNo` and optional identifiers like `payrrn`, `originalTrxId`, `trxId`, and `messageID`. These allow for flexible and precise querying of a reversal's status.">
public function __construct(
public string $TermNo,
public ?string $payrrn = null,
@@ -13,4 +27,5 @@ class GetQrcReversalStatusRequestData extends Data
public ?string $trxId = null,
public ?string $messageID = null,
) {}
// </SECTION>
}

View File

@@ -1,11 +1,25 @@
<?php
/*
// MODULE_CONTRACT: Defines the data structure for the response of a QR Code reversal status request.
// RESPONSIBILITY: To hold and type-safely represent the outcome and status of an SBP QR Code reversal operation.
// INPUTS: Raw JSON object from the API response.
// OUTPUTS: A structured object containing reversal status information.
// LINKS: Sbp/Requests/Reversal/GetQrcReversalStatusRequest.php
*/
namespace Apoloz\AlfaBank\Sbp\Data\Reversal;
// <SECTION name="module_imports" intent="Import the base Spatie Laravel Data class.">
// <BELIEF_STATE "Extending `Spatie\LaravelData\Data` enables automatic casting from JSON and provides DTO benefits.">
use Spatie\LaravelData\Data;
// </SECTION>
// <SECTION name="class_definition" intent="Define a DTO for SBP QR Code reversal status response.">
// <BELIEF_STATE "This DTO provides a clear, type-safe contract for tracking the status of an SBP reversal, crucial for managing financial transactions.">
class GetQrcReversalStatusResponseData extends Data
{
// <SECTION name="constructor_properties" intent="Define the properties of the QR Code reversal status response.">
// <BELIEF_STATE "The constructor includes mandatory `ErrorCode` and `message` for overall status. Optional fields provide detailed information about the transaction, such as `TermNo`, `amount`, `messageID`, `originalQrcId`, `originalTrxId`, payer details, `Url`, `status`, `trxDT`, and `trxId`.">
public function __construct(
public int $ErrorCode,
public ?string $message = null,
@@ -20,4 +34,5 @@ class GetQrcReversalStatusResponseData extends Data
public ?string $trxDT = null,
public ?string $trxId = null,
) {}
// </SECTION>
}

View File

@@ -1,11 +1,25 @@
<?php
/*
// MODULE_CONTRACT: Defines the data structure for an SBP QR Code reversal request payload.
// RESPONSIBILITY: To hold and type-safely represent the parameters needed to initiate a QR Code reversal.
// INPUTS: Terminal number (TermNo), currency, and various optional reversal identifiers.
// OUTPUTS: A structured, type-safe object for the `QrcReversalRequest` payload.
// LINKS: Sbp/Requests/Reversal/QrcReversalRequest.php
*/
namespace Apoloz\AlfaBank\Sbp\Data\Reversal;
// <SECTION name="module_imports" intent="Import the base Spatie Laravel Data class.">
// <BELIEF_STATE "Extending `Spatie\LaravelData\Data` enables automatic casting from arrays and provides DTO benefits.">
use Spatie\LaravelData\Data;
// </SECTION>
// <SECTION name="class_definition" intent="Define a DTO for SBP QR Code reversal request.">
// <BELIEF_STATE "This DTO ensures the reversal request payload is strictly typed and complete, supporting clear communication for critical financial operations with the SBP API.">
class QrcReversalRequestData extends Data
{
// <SECTION name="constructor_properties" intent="Define the properties for the QR Code reversal request.">
// <BELIEF_STATE "The constructor includes the mandatory `TermNo` and `currency`. Optional identifiers like `qrcId`, `payrrn`, `trxId`, `trxDT`, `amount`, `messageID`, `notificationUrl`, and `ReturnRestAmount` provide flexibility for various reversal scenarios.">
public function __construct(
public string $TermNo,
public ?string $qrcId = null,
@@ -19,4 +33,5 @@ class QrcReversalRequestData extends Data
public ?bool $ReturnRestAmount = null,
// extJsonParams not fully implemented as it's optional and dynamic
) {}
// </SECTION>
}

View File

@@ -1,11 +1,25 @@
<?php
/*
// MODULE_CONTRACT: Defines the data structure for the response of a QR Code reversal request.
// RESPONSIBILITY: To hold and type-safely represent the outcome of an SBP QR Code reversal operation.
// INPUTS: Raw JSON object from the API response.
// OUTPUTS: A structured object containing reversal confirmation details.
// LINKS: Sbp/Requests/Reversal/QrcReversalRequest.php
*/
namespace Apoloz\AlfaBank\Sbp\Data\Reversal;
// <SECTION name="module_imports" intent="Import the base Spatie Laravel Data class.">
// <BELIEF_STATE "Extending `Spatie\LaravelData\Data` enables automatic casting from JSON and provides DTO benefits.">
use Spatie\LaravelData\Data;
// </SECTION>
// <SECTION name="class_definition" intent="Define a DTO for SBP QR Code reversal response.">
// <BELIEF_STATE "This DTO provides a clear, type-safe contract for the confirmation details of an SBP reversal, crucial for verifying the transaction.">
class QrcReversalResponseData extends Data
{
// <SECTION name="constructor_properties" intent="Define the properties of the QR Code reversal response.">
// <BELIEF_STATE "The constructor includes mandatory `ErrorCode` and optional fields like `message`, `TermNo`, `amount`, `currency`, `messageID`, `trxDT`, `trxId`, `payrrn`, and `restAmount`. These fields provide the status and key identifiers of the reversal.">
public function __construct(
public int $ErrorCode,
public ?string $message = null,
@@ -18,4 +32,5 @@ class QrcReversalResponseData extends Data
public ?string $payrrn = null,
public ?string $restAmount = null,
) {}
// </SECTION>
}