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:
36
src/Data/Statement/TransactionData.php
Normal file
36
src/Data/Statement/TransactionData.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
// MODULE_CONTRACT: Defines the data structure for a single transaction record.
|
||||
// RESPONSIBILITY: To hold and type-safely represent the details of an individual account transaction.
|
||||
// INPUTS: Raw JSON object from the API response.
|
||||
// OUTPUTS: A structured object containing transaction details.
|
||||
// LINKS: TransactionCollectionData.php
|
||||
*/
|
||||
|
||||
namespace Apoloz\AlfaBank\Data\Statement;
|
||||
|
||||
// <SECTION name="module_imports" intent="Import necessary DTOs and Spatie Laravel Data components.">
|
||||
// <BELIEF_STATE "This DTO includes nested `AmountData` for monetary values and `RurTransferData` for detailed transfer information.">
|
||||
use Spatie\LaravelData\Data;
|
||||
// </SECTION>
|
||||
|
||||
// <SECTION name="class_definition" intent="Define a DTO for a single account transaction.">
|
||||
// <BELIEF_STATE "This DTO provides a comprehensive, type-safe representation of a transaction, essential for consistent data handling and financial reporting.">
|
||||
class TransactionData extends Data
|
||||
{
|
||||
// <SECTION name="constructor_properties" intent="Define all properties that describe an account transaction.">
|
||||
// <BELIEF_STATE "The constructor includes key identifiers like `uuid`, `transactionId`, `operationDate`, `number`, and `direction` (DEBIT/CREDIT). Crucially, `amount` and `amountRub` use the nested `AmountData` DTO to ensure monetary values are correctly associated with their currencies. `paymentPurpose` and `rurTransfer` provide additional context, with `rurTransfer` being another nested DTO for specific RUR details.">
|
||||
public function __construct(
|
||||
public string $uuid,
|
||||
public string $transactionId,
|
||||
public string $operationDate,
|
||||
public string $number,
|
||||
public string $direction, // DEBIT, CREDIT
|
||||
public AmountData $amount, // Nested DTO for amount
|
||||
public AmountData $amountRub, // Nested DTO for amount in RUB
|
||||
public ?string $paymentPurpose = null,
|
||||
public ?RurTransferData $rurTransfer = null, // Nested DTO for RUR specific transfer details
|
||||
public ?string $correspondingAccount = null,
|
||||
) {}
|
||||
// </SECTION>
|
||||
}
|
||||
Reference in New Issue
Block a user