forked from apoloz/alfa-bank-sdk
fix(formating)
This commit is contained in:
@@ -19,6 +19,7 @@ use Saloon\Enums\Method;
|
||||
use Saloon\Http\Request;
|
||||
use Saloon\Http\Response;
|
||||
use Saloon\Traits\Body\HasJsonBody;
|
||||
|
||||
// </SECTION>
|
||||
|
||||
// <SECTION name="class_definition" intent="Define the request to change the account for a CashLink Uni QR Code.">
|
||||
@@ -46,6 +47,14 @@ class ChangeAccForCashUniQrRequest extends Request implements HasBody
|
||||
}
|
||||
// </SECTION>
|
||||
|
||||
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
|
||||
// <BELIEF_STATE "Casting the response to a `ChangeAccForCashUniQrResponseData` DTO provides a type-safe and structured object for the result of the account change operation.">
|
||||
public function createDtoFromResponse(Response $response): ChangeAccForCashUniQrResponseData
|
||||
{
|
||||
return ChangeAccForCashUniQrResponseData::from($response->json());
|
||||
}
|
||||
// </SECTION>
|
||||
|
||||
// <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
|
||||
@@ -55,25 +64,35 @@ class ChangeAccForCashUniQrRequest extends Request implements HasBody
|
||||
'TermNo' => $this->data->TermNo,
|
||||
];
|
||||
|
||||
if ($this->data->messageID !== null) $body['messageID'] = $this->data->messageID;
|
||||
if ($this->data->qrcId !== null) $body['qrcId'] = $this->data->qrcId;
|
||||
if ($this->data->account !== null) $body['account'] = $this->data->account;
|
||||
if ($this->data->accountDR !== null) $body['accountDR'] = $this->data->accountDR;
|
||||
if ($this->data->NewTermNo !== null) $body['NewTermNo'] = $this->data->NewTermNo;
|
||||
if ($this->data->NewMerchantId !== null) $body['NewMerchantId'] = $this->data->NewMerchantId;
|
||||
if ($this->data->redirectUrl !== null) $body['redirectUrl'] = $this->data->redirectUrl;
|
||||
if ($this->data->paymentPageUrl !== null) $body['paymentPageUrl'] = $this->data->paymentPageUrl;
|
||||
if ($this->data->fraudScore !== null) $body['fraudScore'] = $this->data->fraudScore;
|
||||
if ($this->data->messageID !== null) {
|
||||
$body['messageID'] = $this->data->messageID;
|
||||
}
|
||||
if ($this->data->qrcId !== null) {
|
||||
$body['qrcId'] = $this->data->qrcId;
|
||||
}
|
||||
if ($this->data->account !== null) {
|
||||
$body['account'] = $this->data->account;
|
||||
}
|
||||
if ($this->data->accountDR !== null) {
|
||||
$body['accountDR'] = $this->data->accountDR;
|
||||
}
|
||||
if ($this->data->NewTermNo !== null) {
|
||||
$body['NewTermNo'] = $this->data->NewTermNo;
|
||||
}
|
||||
if ($this->data->NewMerchantId !== null) {
|
||||
$body['NewMerchantId'] = $this->data->NewMerchantId;
|
||||
}
|
||||
if ($this->data->redirectUrl !== null) {
|
||||
$body['redirectUrl'] = $this->data->redirectUrl;
|
||||
}
|
||||
if ($this->data->paymentPageUrl !== null) {
|
||||
$body['paymentPageUrl'] = $this->data->paymentPageUrl;
|
||||
}
|
||||
if ($this->data->fraudScore !== null) {
|
||||
$body['fraudScore'] = $this->data->fraudScore;
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
// </SECTION>
|
||||
|
||||
// <SECTION name="response_caster" intent="Map the JSON response to a DTO.">
|
||||
// <BELIEF_STATE "Casting the response to a `ChangeAccForCashUniQrResponseData` DTO provides a type-safe and structured object for the result of the account change operation.">
|
||||
public function createDtoFromResponse(Response $response): ChangeAccForCashUniQrResponseData
|
||||
{
|
||||
return ChangeAccForCashUniQrResponseData::from($response->json());
|
||||
}
|
||||
// </SECTION>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user