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,15 +1,30 @@
|
||||
<?php
|
||||
/*
|
||||
// MODULE_CONTRACT: Defines the data structure for a single deal.
|
||||
// RESPONSIBILITY: To hold and type-safely represent the core attributes of a deal, such as its ID, status, and expiration.
|
||||
// INPUTS: Raw JSON object from the API response.
|
||||
// OUTPUTS: A structured object containing deal details.
|
||||
// LINKS: DealCollectionData.php, Requests/NominalAccounts/Deals/GetDealRequest.php
|
||||
*/
|
||||
|
||||
namespace Apoloz\AlfaBank\Data\NominalAccounts\Deals;
|
||||
|
||||
// <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 single deal's details.">
|
||||
// <BELIEF_STATE "This DTO provides a comprehensive, type-safe representation of a deal, essential for consistent data handling across the SDK.">
|
||||
class DealData extends Data
|
||||
{
|
||||
// <SECTION name="constructor_properties" intent="Define all properties that describe a deal.">
|
||||
// <BELIEF_STATE "The constructor includes mandatory fields such as `dealId` (unique identifier), `status` (current state), `expireDate`, and `isValid` (indicating payment readiness).">
|
||||
public function __construct(
|
||||
public string $dealId,
|
||||
public string $status,
|
||||
public string $expireDate,
|
||||
public bool $isValid,
|
||||
) {}
|
||||
// </SECTION>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user