forked from apoloz/alfa-bank-sdk
refactor(Sbp)
This commit is contained in:
@@ -18,7 +18,6 @@ use Saloon\Contracts\Body\HasBody;
|
||||
use Saloon\Enums\Method;
|
||||
use Saloon\Http\Request;
|
||||
use Saloon\Http\Response;
|
||||
use Saloon\Traits\Body\HasJsonBody;
|
||||
|
||||
// </SECTION>
|
||||
|
||||
@@ -26,7 +25,7 @@ use Saloon\Traits\Body\HasJsonBody;
|
||||
// <BELIEF_STATE "This class encapsulates the logic for modifying a Digital Ruble CashLink QR Code, which is a key management operation.">
|
||||
class ChangeAccForCashUniQrRequest extends Request implements HasBody
|
||||
{
|
||||
use HasJsonBody;
|
||||
use HasStringBody;
|
||||
|
||||
// <SECTION name="http_method" intent="Declare the HTTP verb.">
|
||||
// <BELIEF_STATE "Modifying a resource via an action is correctly represented by a POST request in the SBP API context.">
|
||||
@@ -57,42 +56,42 @@ class ChangeAccForCashUniQrRequest 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. Fields from the DTO are mapped, including conditional parameters for the new account, merchant, redirect URL, etc.">
|
||||
protected function defaultBody(): array
|
||||
protected function defaultBody(): string
|
||||
{
|
||||
$body = [
|
||||
$bodyArray = [
|
||||
'command' => 'ChangeAccForCashUniQr',
|
||||
'TermNo' => $this->data->TermNo,
|
||||
];
|
||||
|
||||
if ($this->data->messageID !== null) {
|
||||
$body['messageID'] = $this->data->messageID;
|
||||
$bodyArray['messageID'] = $this->data->messageID;
|
||||
}
|
||||
if ($this->data->qrcId !== null) {
|
||||
$body['qrcId'] = $this->data->qrcId;
|
||||
$bodyArray['qrcId'] = $this->data->qrcId;
|
||||
}
|
||||
if ($this->data->account !== null) {
|
||||
$body['account'] = $this->data->account;
|
||||
$bodyArray['account'] = $this->data->account;
|
||||
}
|
||||
if ($this->data->accountDR !== null) {
|
||||
$body['accountDR'] = $this->data->accountDR;
|
||||
$bodyArray['accountDR'] = $this->data->accountDR;
|
||||
}
|
||||
if ($this->data->NewTermNo !== null) {
|
||||
$body['NewTermNo'] = $this->data->NewTermNo;
|
||||
$bodyArray['NewTermNo'] = $this->data->NewTermNo;
|
||||
}
|
||||
if ($this->data->NewMerchantId !== null) {
|
||||
$body['NewMerchantId'] = $this->data->NewMerchantId;
|
||||
$bodyArray['NewMerchantId'] = $this->data->NewMerchantId;
|
||||
}
|
||||
if ($this->data->redirectUrl !== null) {
|
||||
$body['redirectUrl'] = $this->data->redirectUrl;
|
||||
$bodyArray['redirectUrl'] = $this->data->redirectUrl;
|
||||
}
|
||||
if ($this->data->paymentPageUrl !== null) {
|
||||
$body['paymentPageUrl'] = $this->data->paymentPageUrl;
|
||||
$bodyArray['paymentPageUrl'] = $this->data->paymentPageUrl;
|
||||
}
|
||||
if ($this->data->fraudScore !== null) {
|
||||
$body['fraudScore'] = $this->data->fraudScore;
|
||||
$bodyArray['fraudScore'] = $this->data->fraudScore;
|
||||
}
|
||||
|
||||
return $body;
|
||||
return CmsSigner::canonicalize($bodyArray);
|
||||
}
|
||||
// </SECTION>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user