refactor(core): enhance SDK structure and documentation
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
@@ -1,27 +1,49 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
// MODULE_CONTRACT: Represents the API call to retrieve the status of a specific payoff.
|
||||
// RESPONSIBILITY: To define the GET request for checking the current status of a payment.
|
||||
// INPUTS: Payoff ID (string).
|
||||
// OUTPUTS: PayoffResponseData (DTO).
|
||||
*/
|
||||
namespace Apoloz\AlfaBank\Requests\NominalAccounts\Payouts;
|
||||
|
||||
// <SECTION name="module_imports" intent="Import DTO and Saloon components.">
|
||||
// <BELIEF_STATE "This request requires the `PayoffResponseData` DTO for its response.">
|
||||
use Apoloz\AlfaBank\Data\NominalAccounts\Payouts\PayoffResponseData;
|
||||
use Saloon\Enums\Method;
|
||||
use Saloon\Http\Request;
|
||||
use Saloon\Http\Response;
|
||||
// </SECTION>
|
||||
|
||||
// <SECTION name="class_definition" intent="Define the request to get the status of a payoff.">
|
||||
// <BELIEF_STATE "This class allows polling for the status of an asynchronous payment process, which is critical for tracking financial transactions.">
|
||||
class GetPayoffStatusRequest extends Request
|
||||
{
|
||||
// <SECTION name="http_method" intent="Declare the HTTP verb.">
|
||||
// <BELIEF_STATE "Retrieving the status of a resource is a read-only operation, making GET the correct verb.">
|
||||
protected Method $method = Method::GET;
|
||||
// </SECTION>
|
||||
|
||||
// <SECTION name="constructor" intent="Inject the payoff's unique identifier.">
|
||||
// <BELIEF_STATE "The `payoffId` is a mandatory path parameter to identify the specific payment whose status is being queried.">
|
||||
public function __construct(
|
||||
protected string $payoffId
|
||||
) {}
|
||||
// </SECTION>
|
||||
|
||||
// <SECTION name="endpoint_resolver" intent="Construct the request URI for the payoff status.">
|
||||
// <BELIEF_STATE "The endpoint is dynamically constructed with the `payoffId` to target the specific payment status resource.">
|
||||
public function resolveEndpoint(): string
|
||||
{
|
||||
return "/api/na/jp/v1/payoffs/{$this->payoffId}/status";
|
||||
}
|
||||
// </SECTION>
|
||||
|
||||
// <SECTION name="response_caster" intent="Map the JSON response to a PayoffResponseData DTO.">
|
||||
// <BELIEF_STATE "Casting the response to a `PayoffResponseData` DTO provides a clear, type-safe object representing the current state of the payment.">
|
||||
public function createDtoFromResponse(Response $response): PayoffResponseData
|
||||
{
|
||||
return PayoffResponseData::from($response->json());
|
||||
}
|
||||
// </SECTION>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user