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,14 +1,28 @@
|
||||
<?php
|
||||
/*
|
||||
// MODULE_CONTRACT: Defines the data structure for the request payload when creating a new beneficiary.
|
||||
// RESPONSIBILITY: To hold and validate all necessary information for beneficiary registration, including personal details, addresses, and signatures.
|
||||
// INPUTS: Raw data array for beneficiary details.
|
||||
// OUTPUTS: A structured, type-safe object for the `CreateBeneficiaryRequest` payload.
|
||||
// LINKS: Requests/NominalAccounts/Beneficiaries/CreateBeneficiaryRequest.php
|
||||
*/
|
||||
|
||||
namespace Apoloz\AlfaBank\Data\NominalAccounts\Beneficiaries;
|
||||
|
||||
// <SECTION name="module_imports" intent="Import necessary DTOs and Spatie Laravel Data components for complex nested data structures.">
|
||||
// <BELIEF_STATE "This DTO has several nested DTOs and collections (`AddressData`, `DigestSignatureData`, `DocumentData`, `PersonalInformationData`). `DataCollectionOf` and `Data` ensure that these are all correctly typed and mapped.">
|
||||
use Apoloz\AlfaBank\Data\NominalAccounts\Payouts\DigestSignatureData;
|
||||
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 beneficiary.">
|
||||
// <BELIEF_STATE "This DTO serves as a robust contract for the complex payload required to create a beneficiary. Type-safety here prevents malformed requests from even being constructed.">
|
||||
class CreateBeneficiaryRequestData extends Data
|
||||
{
|
||||
// <SECTION name="constructor_properties" intent="Define all properties for the beneficiary creation request, including nested DTOs and collections.">
|
||||
// <BELIEF_STATE "The constructor meticulously lists all possible fields, making it clear what data is expected. Mandatory fields are non-nullable, while optional ones are nullable. Collections like `addresses` and `digestSignatures` are type-hinted with `DataCollection` and use `#[DataCollectionOf]` to ensure each item is itself a DTO.">
|
||||
public function __construct(
|
||||
public string $type,
|
||||
public string $countryOfTaxResidence,
|
||||
@@ -31,4 +45,5 @@ class CreateBeneficiaryRequestData extends Data
|
||||
#[DataCollectionOf(DocumentData::class)]
|
||||
public ?DataCollection $documents = null,
|
||||
) {}
|
||||
// </SECTION>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user