forked from apoloz/alfa-bank-sdk
refactor(core): enhance SDK structure and documentation
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
@@ -1,13 +1,27 @@
|
||||
<?php
|
||||
/*
|
||||
// MODULE_CONTRACT: Defines the data structure for the request payload when creating a new payoff.
|
||||
// RESPONSIBILITY: To hold and validate all necessary information for initiating a payment from a nominal account.
|
||||
// INPUTS: Payment type, account number, recipient details, amount, purpose, and digest signatures.
|
||||
// OUTPUTS: A structured, type-safe object for the `CreatePayoffRequest` payload.
|
||||
// LINKS: Requests/NominalAccounts/Payouts/CreatePayoffRequest.php
|
||||
*/
|
||||
|
||||
namespace Apoloz\AlfaBank\Data\NominalAccounts\Payouts;
|
||||
|
||||
// <SECTION name="module_imports" intent="Import necessary DTOs and Spatie Laravel Data components for complex nested data structures.">
|
||||
// <BELIEF_STATE "This DTO orchestrates several other DTOs and collections (`RecipientData`, `PayoutRequisiteData`, `DigestSignatureData`), requiring `DataCollectionOf` for typed arrays.">
|
||||
use Spatie\LaravelData\Attributes\DataCollectionOf;
|
||||
use Spatie\LaravelData\Data;
|
||||
use Spatie\LaravelData\DataCollection;
|
||||
// </SECTION>
|
||||
|
||||
// <SECTION name="class_definition" intent="Define a DTO for creating a new payoff request.">
|
||||
// <BELIEF_STATE "This DTO provides a robust contract for the complex payload required to initiate a payment. It ensures that all financial and security-critical data is strictly typed and correctly structured.">
|
||||
class PayoffRequestData extends Data
|
||||
{
|
||||
// <SECTION name="constructor_properties" intent="Define all properties for the payoff request.">
|
||||
// <BELIEF_STATE "The constructor includes mandatory fields like `type`, `accountNumber`, `recipient`, `payoutRequisite`, `amount`, `purpose`, and `digestSignatures`. Nested DTOs (`RecipientData`, `PayoutRequisiteData`) ensure detailed sub-structures are also type-safe. Optional fields like `deponent`, `requisites`, and `tax` provide flexibility for different payment scenarios.">
|
||||
public function __construct(
|
||||
public string $type,
|
||||
public string $accountNumber,
|
||||
@@ -18,7 +32,8 @@ class PayoffRequestData extends Data
|
||||
#[DataCollectionOf(DigestSignatureData::class)]
|
||||
public DataCollection $digestSignatures,
|
||||
public ?string $deponent = null,
|
||||
public ?array $requisites = null,
|
||||
public ?array $tax = null,
|
||||
public ?array $requisites = null, // Can be nested DTOs if defined
|
||||
public ?array $tax = null, // Can be nested DTOs if defined
|
||||
) {}
|
||||
// </SECTION>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user