Files
alfa-bank-sdk/src/Data/NominalAccounts/Beneficiaries/CreateBeneficiaryRequestData.php
Anatoliy Poloz 706fcb01b2 fix
2026-03-08 18:03:43 +03:00

63 lines
3.2 KiB
PHP

<?php
declare(strict_types=1);
/*
// MODULE_CONTRACT: Defines the data structure for the request payload when creating a new beneficiary.
// RESPONSIBILITY: To hold and validate all necessary information for beneficiary registration, including personal details, addresses, and signatures.
// INPUTS: Raw data array for beneficiary details.
// OUTPUTS: A structured, type-safe object for the `CreateBeneficiaryRequest` payload.
// LINKS: Requests/NominalAccounts/Beneficiaries/CreateBeneficiaryRequest.php
*/
namespace Apoloz\AlfaBank\Data\NominalAccounts\Beneficiaries;
// <SECTION name="module_imports" intent="Import necessary DTOs and Spatie Laravel Data components for complex nested data structures.">
// <BELIEF_STATE "This DTO has several nested DTOs and collections (`AddressData`, `DigestSignatureData`, `DocumentData`, `PersonalInformationData`). `DataCollectionOf` and `Data` ensure that these are all correctly typed and mapped.">
use Apoloz\AlfaBank\Data\NominalAccounts\Payouts\DigestSignatureData;
use Apoloz\AlfaBank\Traits\SignableData;
use Spatie\LaravelData\Attributes\DataCollectionOf;
use Spatie\LaravelData\Attributes\Validation\Email;
use Spatie\LaravelData\Attributes\Validation\Numeric;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\DataCollection;
// </SECTION>
// <SECTION name="class_definition" intent="Define a DTO for creating a new beneficiary.">
// <BELIEF_STATE "This DTO serves as a robust contract for the complex payload required to create a beneficiary. Type-safety here prevents malformed requests from even being constructed.">
class CreateBeneficiaryRequestData extends Data
{
use SignableData;
// <SECTION name="constructor_properties" intent="Define all properties for the beneficiary creation request, including nested DTOs and collections.">
// <BELIEF_STATE "The constructor meticulously lists all possible fields, making it clear what data is expected. Mandatory fields are non-nullable, while optional ones are nullable. Collections like `addresses` and `digestSignatures` are type-hinted with `DataCollection` and use `#[DataCollectionOf]` to ensure each item is itself a DTO.">
public function __construct(
public string $type,
public string $countryOfTaxResidence,
#[DataCollectionOf(AddressData::class)]
public DataCollection $addresses,
public ?bool $isBeneficiary = null,
#[DataCollectionOf(DigestSignatureData::class)]
public ?DataCollection $digestSignatures = null,
public ?string $accountNumber = null,
public ?bool $taxResidentUS = null,
public ?bool $foreignTaxResident = null,
public ?bool $financialActivities = null,
public ?string $name = null,
public ?string $registrationDate = null,
#[Numeric]
public ?string $inn = null,
#[Numeric]
public ?string $kpp = null,
#[Numeric]
public ?string $ogrn = null,
public ?PersonalInformationData $personalInformation = null,
public ?string $phoneNumber = null,
#[Email]
public ?string $email = null,
#[DataCollectionOf(DocumentData::class)]
public ?DataCollection $documents = null,
) {}
// </SECTION>
}