refactor(core): enhance SDK structure and documentation

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
2026-01-18 21:48:25 +03:00
parent 3da69c03e1
commit d214eecebe
378 changed files with 10514 additions and 496 deletions

View File

@@ -1,41 +1,44 @@
<?php
/*
// MODULE_CONTRACT: Represents a Sandbox API call for testing signature and encryption mechanisms.
// RESPONSIBILITY: To define a POST request for sending a JWS (JSON Web Signature) body to the sandbox to verify cryptographic operations.
// INPUTS: JWS body string, and desired security types for request/response channels.
// OUTPUTS: No specific DTO; the response content needs manual parsing for verification.
*/
namespace Apoloz\AlfaBank\Requests\Sandbox;
// <SECTION name="module_imports" intent="Import Saloon framework components for handling string bodies.">
// <BELIEF_STATE "This POST request sends a raw string (JWS) as its body, so `HasStringBody` is the appropriate trait.">
use Apoloz\AlfaBank\Data\Sandbox\SandboxTestResponseData;
use Saloon\Contracts\Body\HasBody;
use Saloon\Enums\Method;
use Saloon\Http\Request;
use Saloon\Traits\Body\HasStringBody;
use Saloon\Http\Response;
use Saloon\Traits\Body\HasJsonBody;
class SignatureEncryptionTestRequest extends Request implements HasBody
{
use HasStringBody;
use HasJsonBody;
protected Method $method = Method::POST;
public function __construct(
protected string $jwsBody,
protected string $requestChannelSecurity = 'SIGNATURE',
protected string $responseChannelSecurity = 'SIGNATURE'
protected string $data
) {}
public function resolveEndpoint(): string
{
return '/api/signature-encryption-tests/json';
}
protected function defaultHeaders(): array
{
return [
'Accept' => 'application/jose',
'Content-Type' => 'application/jose',
'X-Request-ChannelSecurity' => $this->requestChannelSecurity,
'X-Response-ChannelSecurity' => $this->responseChannelSecurity,
];
return '/api/sandbox/v1/test/signature-encryption';
}
protected function defaultBody(): ?string
{
return $this->jwsBody;
return $this->data;
}
public function createDtoFromResponse(Response $response): SandboxTestResponseData
{
return SandboxTestResponseData::from(['result' => $response->body()]);
}
}