33 lines
1.5 KiB
PHP
33 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
/*
|
|
// MODULE_CONTRACT: Defines the data structure for a specific wallet's balance.
|
|
// RESPONSIBILITY: To hold and type-safely represent the free and held amounts within a financial wallet.
|
|
// INPUTS: Raw JSON object from the API response.
|
|
// OUTPUTS: A structured object containing wallet balance details.
|
|
// LINKS: BeneficiaryBalanceData.php (uses this DTO)
|
|
*/
|
|
|
|
namespace Apoloz\AlfaBank\Data\NominalAccounts\Beneficiaries;
|
|
|
|
// <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 other DTO benefits.">
|
|
use Spatie\LaravelData\Data;
|
|
|
|
// </SECTION>
|
|
|
|
// <SECTION name="class_definition" intent="Define a DTO for a specific wallet's balance.">
|
|
// <BELIEF_STATE "This DTO provides a precise, type-safe contract for individual wallet balances, distinguishing between funds that are `free` (available) and `held` (blocked).">
|
|
class WalletBalanceData extends Data
|
|
{
|
|
// <SECTION name="constructor_properties" intent="Define the properties of a wallet balance.">
|
|
// <BELIEF_STATE "The constructor captures the `walletType` (e.g., nominal, tax), the `freeBalance` (funds available for use), and the `heldBalance` (funds currently blocked or reserved). This granular detail is crucial for financial applications.">
|
|
public function __construct(
|
|
public string $walletType,
|
|
public string $freeBalance,
|
|
public string $heldBalance,
|
|
) {}
|
|
// </SECTION>
|
|
}
|