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,14 +1,28 @@
|
||||
<?php
|
||||
/*
|
||||
// MODULE_CONTRACT: Defines the data structure for the request payload when creating a test RUB payment in the sandbox.
|
||||
// RESPONSIBILITY: To hold and validate all necessary information for simulating a ruble payment.
|
||||
// INPUTS: Various payment details for payer, payee, amount, purpose, and optional digital signatures.
|
||||
// OUTPUTS: A structured, type-safe object for the `CreateRubPaymentRequest` payload.
|
||||
// LINKS: Requests/Sandbox/Payments/CreateRubPaymentRequest.php
|
||||
*/
|
||||
|
||||
namespace Apoloz\AlfaBank\Data\Sandbox\Payments;
|
||||
|
||||
// <SECTION name="module_imports" intent="Import necessary DTOs and Spatie Laravel Data components.">
|
||||
// <BELIEF_STATE "This DTO can include `DigestSignatureData` as a collection, so `DataCollectionOf` is used for type safety.">
|
||||
use Apoloz\AlfaBank\Data\NominalAccounts\Payouts\DigestSignatureData;
|
||||
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 sandbox RUB payment.">
|
||||
// <BELIEF_STATE "This DTO provides a robust contract for simulating payments, ensuring all test payment data is strictly typed and correctly structured.">
|
||||
class CreateRubPaymentRequestData extends Data
|
||||
{
|
||||
// <SECTION name="constructor_properties" intent="Define all properties for the test RUB payment request.">
|
||||
// <BELIEF_STATE "The constructor includes comprehensive payment details covering `externalId`, `amount`, `date`, `number`, `operationCode`, full payer/payee information (`payeeAccount`, `payeeBankBic`, etc.), `purpose`, and default values for `priority` and `deliveryKind`. Optional fields like `digestSignatures` and departmental/VAT info provide flexibility for detailed testing.">
|
||||
public function __construct(
|
||||
public string $externalId,
|
||||
public float $amount,
|
||||
@@ -25,7 +39,7 @@ class CreateRubPaymentRequestData extends Data
|
||||
public string $payerName,
|
||||
public string $purpose,
|
||||
public string $priority = '5',
|
||||
public string $deliveryKind = 'электронно',
|
||||
public string $deliveryKind = 'электронно', // "electronically"
|
||||
public string $urgencyCode = 'NORMAL',
|
||||
public ?string $payerKpp = null,
|
||||
public ?string $payeeKpp = null,
|
||||
@@ -33,7 +47,8 @@ class CreateRubPaymentRequestData extends Data
|
||||
public ?string $payeeBankCorrAccount = null,
|
||||
#[DataCollectionOf(DigestSignatureData::class)]
|
||||
public ?DataCollection $digestSignatures = null,
|
||||
public ?array $departmentalInfo = null,
|
||||
public ?array $vat = null,
|
||||
public ?array $departmentalInfo = null, // Can be a nested DTO
|
||||
public ?array $vat = null, // Can be a nested DTO
|
||||
) {}
|
||||
// </SECTION>
|
||||
}
|
||||
|
||||
12
src/Data/Sandbox/SandboxTestResponseData.php
Normal file
12
src/Data/Sandbox/SandboxTestResponseData.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Apoloz\AlfaBank\Data\Sandbox;
|
||||
|
||||
use Spatie\LaravelData\Data;
|
||||
|
||||
class SandboxTestResponseData extends Data
|
||||
{
|
||||
public function __construct(
|
||||
public string $result,
|
||||
) {}
|
||||
}
|
||||
Reference in New Issue
Block a user