Files
alfa-bank-sdk/src/Sbp/Data/Reversal/QrcReversalRequestData.php

46 lines
2.2 KiB
PHP

<?php
declare(strict_types=1);
/*
// MODULE_CONTRACT: Defines the data structure for an SBP QR Code reversal request payload.
// RESPONSIBILITY: To hold and type-safely represent the parameters needed to initiate a QR Code reversal.
// INPUTS: Terminal number (TermNo), currency, and various optional reversal identifiers.
// OUTPUTS: A structured, type-safe object for the `QrcReversalRequest` payload.
// LINKS: Sbp/Requests/Reversal/QrcReversalRequest.php
*/
namespace Apoloz\AlfaBank\Sbp\Data\Reversal;
// <SECTION name="module_imports" intent="Import the base Spatie Laravel Data class.">
// <BELIEF_STATE "Extending `Spatie\LaravelData\Data` enables automatic casting from arrays and provides DTO benefits.">
use Spatie\LaravelData\Attributes\MapInputName;
use Spatie\LaravelData\Attributes\MapName;
use Spatie\LaravelData\Attributes\MapOutputName;
use Spatie\LaravelData\Data;
// </SECTION>
// <SECTION name="class_definition" intent="Define a DTO for SBP QR Code reversal request.">
// <BELIEF_STATE "This DTO ensures the reversal request payload is strictly typed and complete, supporting clear communication for critical financial operations with the SBP API.">
class QrcReversalRequestData extends Data
{
// <SECTION name="constructor_properties" intent="Define the properties for the QR Code reversal request.">
// <BELIEF_STATE "The constructor includes the mandatory `termNo` and `currency`. Optional identifiers like `qrcId`, `payrrn`, `trxId`, `trxDT`, `amount`, `messageID`, `notificationUrl`, and `returnRestAmount` provide flexibility for various reversal scenarios.">
public function __construct(
#[MapName('TermNo')]
public string $termNo,
public ?string $qrcId = null,
public ?string $payrrn = null,
public ?string $trxId = null,
public ?string $trxDT = null,
public ?string $amount = null,
public string $currency = 'RUB',
public ?string $messageID = null,
#[MapOutputName('queryData.notificationUrl')]
public ?string $notificationUrl = null,
#[MapName('ReturnRestAmount')]
public ?bool $returnRestAmount = null,
// extJsonParams not fully implemented as it's optional and dynamic
) {}
// </SECTION>
}