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 a specific beneficiary's balance.
|
||||
// RESPONSIBILITY: To hold and type-safely represent the financial balance details of a beneficiary for a given account and date.
|
||||
// INPUTS: Raw JSON object from the API response.
|
||||
// OUTPUTS: A structured object containing beneficiary balance information.
|
||||
// LINKS: Requests/NominalAccounts/Beneficiaries/GetBeneficiaryBalanceRequest.php
|
||||
*/
|
||||
|
||||
namespace Apoloz\AlfaBank\Data\NominalAccounts\Beneficiaries;
|
||||
|
||||
// <SECTION name="module_imports" intent="Import necessary DTOs and Spatie Laravel Data components.">
|
||||
// <BELIEF_STATE "This DTO represents a balance which can be composed of multiple `WalletBalanceData` objects. `DataCollectionOf` is essential for auto-casting.">
|
||||
use Spatie\LaravelData\Attributes\DataCollectionOf;
|
||||
use Spatie\LaravelData\Data;
|
||||
use Spatie\LaravelData\DataCollection;
|
||||
// </SECTION>
|
||||
|
||||
// <SECTION name="class_definition" intent="Define a DTO for a beneficiary's balance details.">
|
||||
// <BELIEF_STATE "A dedicated DTO ensures the balance information is always accessed in a type-safe and consistent manner, preventing common errors when dealing with financial data.">
|
||||
class BeneficiaryBalanceData extends Data
|
||||
{
|
||||
// <SECTION name="constructor_properties" intent="Define the properties related to a beneficiary's balance.">
|
||||
// <BELIEF_STATE "Properties like `beneficiaryId`, `accountNumber`, and `date` are key identifiers for the balance. The `balances` property is a collection of `WalletBalanceData`, enabling a detailed breakdown of the balance across different wallet types.">
|
||||
public function __construct(
|
||||
public string $beneficiaryId,
|
||||
public string $accountNumber,
|
||||
@@ -15,4 +29,5 @@ class BeneficiaryBalanceData extends Data
|
||||
#[DataCollectionOf(WalletBalanceData::class)]
|
||||
public ?DataCollection $balances = null,
|
||||
) {}
|
||||
// </SECTION>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user