refactor(Sbp)
This commit is contained in:
@@ -14,11 +14,12 @@ namespace Apoloz\AlfaBank\Sbp\Requests\Status;
|
||||
// <BELIEF_STATE "This POST request requires specific DTOs for its JSON body and its response, along with Saloon's body-handling traits.">
|
||||
use Apoloz\AlfaBank\Sbp\Data\Status\GetQrcStatusRequestData;
|
||||
use Apoloz\AlfaBank\Sbp\Data\Status\GetQrcStatusResponseData;
|
||||
use Apoloz\AlfaBank\Utils\CmsSigner;
|
||||
use Saloon\Contracts\Body\HasBody;
|
||||
use Saloon\Enums\Method;
|
||||
use Saloon\Http\Request;
|
||||
use Saloon\Http\Response;
|
||||
use Saloon\Traits\Body\HasJsonBody;
|
||||
use Saloon\Traits\Body\HasStringBody;
|
||||
|
||||
// </SECTION>
|
||||
|
||||
@@ -26,7 +27,7 @@ use Saloon\Traits\Body\HasJsonBody;
|
||||
// <BELIEF_STATE "This class encapsulates the logic for querying the status of an SBP QR Code, which is crucial for tracking payment flows.">
|
||||
class GetQrcStatusRequest extends Request implements HasBody
|
||||
{
|
||||
use HasJsonBody;
|
||||
use HasStringBody;
|
||||
|
||||
// <SECTION name="http_method" intent="Declare the HTTP verb.">
|
||||
// <BELIEF_STATE "Even though it retrieves data, SBP status checks are often performed via POST requests with a JSON body.">
|
||||
@@ -57,12 +58,14 @@ class GetQrcStatusRequest extends Request implements HasBody
|
||||
|
||||
// <SECTION name="body_builder" intent="Construct the JSON body for the request.">
|
||||
// <BELIEF_STATE "The `command` field specifies the operation to the SBP API. The `TermNo` is mandatory, and `qrcId`, `payrrn`, and `messageID` are optional filters to pinpoint the transaction.">
|
||||
protected function defaultBody(): array
|
||||
protected function defaultBody(): string
|
||||
{
|
||||
return array_merge(
|
||||
$bodyArray = array_merge(
|
||||
['command' => 'GetQRCstatus'],
|
||||
$this->data->toArray()
|
||||
);
|
||||
|
||||
return CmsSigner::canonicalize($bodyArray);
|
||||
}
|
||||
// </SECTION>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user