forked from apoloz/alfa-bank-sdk
41 lines
2.1 KiB
PHP
41 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
/*
|
|
// MODULE_CONTRACT: Defines the data structure for an SBP QR Code subscription registration request payload.
|
|
// RESPONSIBILITY: To hold and type-safely represent the parameters needed to register a new SBP subscription.
|
|
// INPUTS: Terminal number (TermNo), subscription purpose, notification URL, and various optional QR Code parameters.
|
|
// OUTPUTS: A structured, type-safe object for the `RegQrSubRequest` payload.
|
|
// LINKS: Sbp/Requests/Subscription/RegQrSubRequest.php
|
|
*/
|
|
|
|
namespace Apoloz\AlfaBank\Sbp\Data\Subscription;
|
|
|
|
// <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\MapName;
|
|
use Spatie\LaravelData\Attributes\MapOutputName;
|
|
use Spatie\LaravelData\Data;
|
|
// </SECTION>
|
|
|
|
// <SECTION name="class_definition" intent="Define a DTO for SBP QR Code subscription registration request.">
|
|
// <BELIEF_STATE "This DTO ensures the subscription registration payload is strictly typed and complete, supporting clear communication with the SBP API for recurring payments.">
|
|
class RegQrSubRequestData extends Data
|
|
{
|
|
// <SECTION name="constructor_properties" intent="Define the properties for the QR Code subscription registration request.">
|
|
// <BELIEF_STATE "The constructor includes mandatory `termNo`, `subscriptionPurpose`, `notificationUrl`, and defaults `qrcType` to '03' (subscription). Optional fields like `qrTtl`, `redirectUrl`, `subscriptionServiceId`, and `subscriptionServiceName` provide flexibility for detailed subscription setup.">
|
|
public function __construct(
|
|
#[MapName('TermNo')]
|
|
public string $termNo,
|
|
public string $subscriptionPurpose,
|
|
#[MapOutputName('queryData.notificationUrl')]
|
|
public string $notificationUrl,
|
|
public string $qrcType = '03', // '03' = Subscription
|
|
public ?string $qrTtl = null,
|
|
public ?string $redirectUrl = null,
|
|
public ?string $subscriptionServiceId = null,
|
|
public ?string $subscriptionServiceName = null,
|
|
) {}
|
|
// </SECTION>
|
|
}
|