forked from apoloz/alfa-bank-sdk
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3cf15b7913 |
39
src/Sbp/Data/GetQRCdQueryData.php
Normal file
39
src/Sbp/Data/GetQRCdQueryData.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/*
|
||||
// MODULE_CONTRACT: Defines the data structure for the response when generating an SBP QR Code.
|
||||
// RESPONSIBILITY: To provide a strongly-typed structure for the API's response to QR code generation requests, including status, potential error messages, and the generated QR code data (image, payload, ID).
|
||||
// INPUTS: Raw array data from the SBP QR Code generation API response.
|
||||
// OUTPUTS: An instantiated DTO with properties mapped from the input array.
|
||||
// LINKS: Sbp/Requests/GetQrCodeRequest.php, README.md#sbp-api
|
||||
*/
|
||||
|
||||
namespace Apoloz\AlfaBank\Sbp\Data;
|
||||
|
||||
// <SECTION name="module_imports" intent="Import the base Spatie\LaravelData class.">
|
||||
// <BELIEF_STATE "This class extends `Spatie\LaravelData\Data` to leverage its robust data mapping and type safety, ensuring consistent and predictable handling of SBP QR Code response payloads.">
|
||||
use Spatie\LaravelData\Data;
|
||||
|
||||
// </SECTION>
|
||||
/**
|
||||
*
|
||||
* "queryData":
|
||||
{
|
||||
"notificationUrl":"https://sbp-payments",
|
||||
"SenderFIO":"Иванов|Иван|Иванович",
|
||||
"SenderID":"0079123456789",
|
||||
"SenderBankBIC":"44525593"
|
||||
}
|
||||
*
|
||||
* */
|
||||
// <SECTION name="class_definition" intent="Define the QR Code response data structure.">
|
||||
// <BELIEF_STATE "The `QrCodeResponseData` DTO encapsulates all possible fields returned by the SBP QR Code generation API. Fields are explicitly typed as nullable to accommodate variations in API responses, particularly for error scenarios where certain data might be absent.">
|
||||
class GetQRCdQueryData extends Data
|
||||
{
|
||||
public function __construct(
|
||||
public string $notificationUrl,
|
||||
public string $SenderFIO,
|
||||
public string $SenderID
|
||||
) {}
|
||||
}
|
||||
@@ -54,8 +54,8 @@ class QrCodeRequestData extends Data
|
||||
public ?string $width = null,
|
||||
public ?string $height = null,
|
||||
|
||||
// <BELIEF_STATE "The `notificationUrl` specifies where the bank should send webhook notifications about payment status changes.">
|
||||
public ?string $notificationUrl = null,
|
||||
// <BELIEF_STATE "The `queryData` specifies where the bank should send webhook notifications about payment status changes.">
|
||||
public GetQRCdQueryData $queryData,
|
||||
|
||||
// Dynamic QR specific fields
|
||||
// <BELIEF_STATE "The `OrderNumber` is specific to dynamic QRs, providing a unique identifier for the order in the merchant's system.">
|
||||
@@ -68,17 +68,6 @@ class QrCodeRequestData extends Data
|
||||
// <BELIEF_STATE "Subscription service identifiers are used for recurring payment scenarios with SBP.">
|
||||
public ?string $subscriptionServiceId = null,
|
||||
public ?string $subscriptionServiceName = null,
|
||||
|
||||
// Optional user data for Dynamic QR (often part of sender identification)
|
||||
// <BELIEF_STATE "Sender details are crucial for identifying the payer in certain SBP scenarios. `#[MapName]` ensures these follow API conventions.">
|
||||
#[MapName('SenderFIO')]
|
||||
public ?string $senderFio = null,
|
||||
|
||||
#[MapName('SenderID')]
|
||||
public ?string $senderId = null,
|
||||
|
||||
#[MapName('SenderBankBIC')]
|
||||
public ?string $senderBankBic = null,
|
||||
) {}
|
||||
// </SECTION>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user