Files
alfa-bank-sdk/src/Data/NominalAccounts/Payouts/PayoffRequestData.php

40 lines
2.3 KiB
PHP

<?php
/*
// MODULE_CONTRACT: Defines the data structure for the request payload when creating a new payoff.
// RESPONSIBILITY: To hold and validate all necessary information for initiating a payment from a nominal account.
// INPUTS: Payment type, account number, recipient details, amount, purpose, and digest signatures.
// OUTPUTS: A structured, type-safe object for the `CreatePayoffRequest` payload.
// LINKS: Requests/NominalAccounts/Payouts/CreatePayoffRequest.php
*/
namespace Apoloz\AlfaBank\Data\NominalAccounts\Payouts;
// <SECTION name="module_imports" intent="Import necessary DTOs and Spatie Laravel Data components for complex nested data structures.">
// <BELIEF_STATE "This DTO orchestrates several other DTOs and collections (`RecipientData`, `PayoutRequisiteData`, `DigestSignatureData`), requiring `DataCollectionOf` for typed arrays.">
use Spatie\LaravelData\Attributes\DataCollectionOf;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\DataCollection;
// </SECTION>
// <SECTION name="class_definition" intent="Define a DTO for creating a new payoff request.">
// <BELIEF_STATE "This DTO provides a robust contract for the complex payload required to initiate a payment. It ensures that all financial and security-critical data is strictly typed and correctly structured.">
class PayoffRequestData extends Data
{
// <SECTION name="constructor_properties" intent="Define all properties for the payoff request.">
// <BELIEF_STATE "The constructor includes mandatory fields like `type`, `accountNumber`, `recipient`, `payoutRequisite`, `amount`, `purpose`, and `digestSignatures`. Nested DTOs (`RecipientData`, `PayoutRequisiteData`) ensure detailed sub-structures are also type-safe. Optional fields like `deponent`, `requisites`, and `tax` provide flexibility for different payment scenarios.">
public function __construct(
public string $type,
public string $accountNumber,
public RecipientData $recipient,
public PayoutRequisiteData $payoutRequisite,
public string $amount,
public string $purpose,
#[DataCollectionOf(DigestSignatureData::class)]
public DataCollection $digestSignatures,
public ?string $deponent = null,
public ?array $requisites = null, // Can be nested DTOs if defined
public ?array $tax = null, // Can be nested DTOs if defined
) {}
// </SECTION>
}