forked from apoloz/alfa-bank-sdk
34 lines
1.9 KiB
PHP
34 lines
1.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
/*
|
|
// MODULE_CONTRACT: Defines the data structure for a single beneficiary transaction record.
|
|
// RESPONSIBILITY: To provide a strongly-typed structure for individual transaction details related to a beneficiary, ensuring consistency and ease of consumption for API responses.
|
|
// INPUTS: Raw array data representing a single beneficiary transaction from the API.
|
|
// OUTPUTS: An instantiated DTO with properties mapped from the input array.
|
|
// LINKS: Data/NominalAccounts/Beneficiaries/BeneficiaryTransactionCollectionData.php
|
|
*/
|
|
|
|
namespace Apoloz\AlfaBank\Data\NominalAccounts\Beneficiaries;
|
|
|
|
// <SECTION name="module_imports" intent="Import the base Spatie\LaravelData class.">
|
|
// <BELIEF_STATE "This class extends `Spatie\LaravelData\Data` to leverage its robust data mapping and type safety, ensuring consistent and predictable handling of individual transaction payloads.">
|
|
use Spatie\LaravelData\Data;
|
|
|
|
// </SECTION>
|
|
|
|
// <SECTION name="class_definition" intent="Define the beneficiary transaction data structure.">
|
|
// <BELIEF_STATE "The `BeneficiaryTransactionData` DTO encapsulates the core details of a single transaction. It defines essential properties like `type` and `amount` as mandatory, while `comment` is optional, reflecting the common structure of transaction records.">
|
|
class BeneficiaryTransactionData extends Data
|
|
{
|
|
// <SECTION name="constructor_properties" intent="Define the properties of the transaction DTO.">
|
|
// <BELIEF_STATE "Properties are defined directly in the constructor for conciseness and immutability. `type` and `amount` are crucial for any transaction and are thus required. `comment` is nullable as it may not always be present in transaction records.">
|
|
public function __construct(
|
|
public string $type,
|
|
public string $amount,
|
|
public ?string $comment = null,
|
|
) {}
|
|
// </SECTION>
|
|
}
|
|
// </SECTION>
|